Skip to content

Commit

Permalink
Move tower_common tests with tower_organization.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclay committed Feb 8, 2020
1 parent c10f4a8 commit c92697a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 49 deletions.
2 changes: 0 additions & 2 deletions test/integration/targets/tower_common/aliases

This file was deleted.

47 changes: 0 additions & 47 deletions test/integration/targets/tower_common/tasks/main.yml

This file was deleted.

47 changes: 47 additions & 0 deletions test/integration/targets/tower_organization/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,50 @@
- name: Make sure the default Default organization exists
tower_organization:
name: Default

- name: Check that SSL is available
tower_organization:
name: Default
register: result

- name: Check we haven't changed anything
assert:
that: result is not changed

- name: Check that SSL is available and verify_ssl is enabled (task must fail)
tower_organization:
name: Default
environment:
TOWER_CERTIFICATE: /dev/null # force check failure
ignore_errors: true
register: check_ssl_is_used

- name: Check that connection failed
assert:
that:
- check_ssl_is_used is failed
- >
'Could not establish a secure connection' in (check_ssl_is_used.module_stderr + check_ssl_is_used.module_stdout)
or 'OpenSSL.SSL.Error' in (check_ssl_is_used.module_stderr + check_ssl_is_used.module_stdout)
# 'Could not establish a secure connection': when pyOpenSSL isn't available
# 'OpenSSL.SSL.Error': with pyOpenSSL, see https://github.com/urllib3/urllib3/pull/1517
- name: Disable verify_ssl in ~/.tower_cli.cfg
copy:
dest: ~/.tower_cli.cfg
content: |
[general]
verify_ssl = False
force: false # ensure remote file doesn't exist

- block:
- name: Check that verify_ssl is disabled (task must not fail)
tower_organization:
name: Default
environment:
TOWER_CERTIFICATE: /dev/null # should not fail because verify_ssl is disabled
always:
- name: Delete ~/.tower_cli.cfg
file:
path: ~/.tower_cli.cfg
state: absent

0 comments on commit c92697a

Please sign in to comment.