mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 10:57:36 -02:30
feat: remove collection support for oauth (#15623)
Co-authored-by: Alan Rominger <arominge@redhat.com>
This commit is contained in:
@@ -1,131 +0,0 @@
|
||||
---
|
||||
- name: Generate a test id
|
||||
set_fact:
|
||||
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||
when: test_id is not defined
|
||||
|
||||
- name: Generate names
|
||||
set_fact:
|
||||
app1_name: "AWX-Collection-tests-application-app1-{{ test_id }}"
|
||||
app2_name: "AWX-Collection-tests-application-app2-{{ test_id }}"
|
||||
app3_name: "AWX-Collection-tests-application-app3-{{ test_id }}"
|
||||
|
||||
- block:
|
||||
- name: Create an application
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
authorization_grant_type: "password"
|
||||
client_type: "public"
|
||||
organization: "Default"
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Run an application with exists
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
authorization_grant_type: "password"
|
||||
client_type: "public"
|
||||
organization: "Default"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is not changed"
|
||||
|
||||
- name: Delete our application
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
organization: "Default"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Run an application with exists
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
authorization_grant_type: "password"
|
||||
client_type: "public"
|
||||
organization: "Default"
|
||||
state: exists
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Delete our application
|
||||
application:
|
||||
name: "{{ app1_name }}"
|
||||
organization: "Default"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create a second application
|
||||
application:
|
||||
name: "{{ app2_name }}"
|
||||
authorization_grant_type: "authorization-code"
|
||||
client_type: "confidential"
|
||||
organization: "Default"
|
||||
description: "Another application"
|
||||
redirect_uris:
|
||||
- http://tower.com/api/v2/
|
||||
- http://tower.com/api/v2/teams
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
|
||||
- name: Create an all trusting application
|
||||
application:
|
||||
name: "{{ app3_name }}"
|
||||
organization: "Default"
|
||||
description: "All Trusting Application"
|
||||
skip_authorization: true
|
||||
authorization_grant_type: "password"
|
||||
client_type: "confidential"
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result is changed"
|
||||
- "'client_secret' in result"
|
||||
|
||||
- name: Rename an inventory
|
||||
application:
|
||||
name: "{{ app3_name }}"
|
||||
new_name: "{{ app3_name }}a"
|
||||
organization: Default
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.changed
|
||||
|
||||
always:
|
||||
- name: Delete our application
|
||||
application:
|
||||
name: "{{ item }}"
|
||||
organization: "Default"
|
||||
state: absent
|
||||
register: result
|
||||
loop:
|
||||
- "{{ app1_name }}"
|
||||
- "{{ app2_name }}"
|
||||
- "{{ app3_name }}"
|
||||
- "{{ app3_name }}a"
|
||||
@@ -1,115 +0,0 @@
|
||||
---
|
||||
- name: Generate a test ID
|
||||
set_fact:
|
||||
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||
when: test_id is not defined
|
||||
|
||||
- name: Generate names
|
||||
set_fact:
|
||||
token_description: "AWX-Collection-tests-token-description-{{ test_id }}"
|
||||
|
||||
- name: Try to use a token as a dict which is missing the token parameter
|
||||
job_list:
|
||||
controller_oauthtoken:
|
||||
not_token: "This has no token entry"
|
||||
register: results
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- results is failed
|
||||
- '"The provided dict in controller_oauthtoken did not properly contain the token entry" == results.msg'
|
||||
|
||||
- name: Try to use a token as a list
|
||||
job_list:
|
||||
controller_oauthtoken:
|
||||
- dummy_token
|
||||
register: results
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- results is failed
|
||||
- '"The provided controller_oauthtoken type was not valid (list). Valid options are str or dict." == results.msg'
|
||||
|
||||
- name: Try to delete a token with no existing_token or existing_token_id
|
||||
token:
|
||||
state: absent
|
||||
register: results
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- results is failed
|
||||
# We don't assert a message here because it's handled by ansible
|
||||
|
||||
- name: Try to delete a token with both existing_token or existing_token_id
|
||||
token:
|
||||
existing_token:
|
||||
id: 1234
|
||||
existing_token_id: 1234
|
||||
state: absent
|
||||
register: results
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- results is failed
|
||||
# We don't assert a message here because it's handled by ansible
|
||||
|
||||
|
||||
- block:
|
||||
- name: Create a Token
|
||||
token:
|
||||
description: '{{ token_description }}'
|
||||
scope: "write"
|
||||
state: present
|
||||
register: new_token
|
||||
|
||||
- name: Validate our token works by token
|
||||
job_list:
|
||||
controller_oauthtoken: "{{ controller_token.token }}"
|
||||
register: job_list
|
||||
|
||||
- name: Validate our token works by object
|
||||
job_list:
|
||||
controller_oauthtoken: "{{ controller_token }}"
|
||||
register: job_list
|
||||
|
||||
always:
|
||||
- name: Delete our Token with our own token
|
||||
token:
|
||||
existing_token: "{{ controller_token }}"
|
||||
controller_oauthtoken: "{{ controller_token }}"
|
||||
state: absent
|
||||
when: controller_token is defined
|
||||
register: results
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- results is changed or results is skipped
|
||||
|
||||
- block:
|
||||
- name: Create a second token
|
||||
token:
|
||||
description: '{{ token_description }}'
|
||||
scope: "write"
|
||||
state: present
|
||||
register: results
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- results is changed
|
||||
|
||||
always:
|
||||
- name: Delete the second Token with our own token
|
||||
token:
|
||||
existing_token_id: "{{ controller_token['id'] }}"
|
||||
controller_oauthtoken: "{{ controller_token }}"
|
||||
state: absent
|
||||
when: controller_token is defined
|
||||
register: results
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- results is changed or resuslts is skipped
|
||||
@@ -220,7 +220,6 @@
|
||||
user:
|
||||
controller_username: "{{ username }}-orgadmin"
|
||||
controller_password: "{{ username }}-orgadmin"
|
||||
controller_oauthtoken: false # Hack for CI where we use oauth in config file
|
||||
username: "{{ username }}"
|
||||
first_name: Joe
|
||||
password: "{{ 65535 | random | to_uuid }}"
|
||||
|
||||
Reference in New Issue
Block a user