mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 01:47:31 -02:30
Fixing linting issues
This commit is contained in:
@@ -7,15 +7,15 @@
|
|||||||
- name: Generate usernames
|
- name: Generate usernames
|
||||||
set_fact:
|
set_fact:
|
||||||
usernames:
|
usernames:
|
||||||
- "AWX-Collection-tests-tower_api_lookup-user1-{{ test_id }}"
|
- "AWX-Collection-tests-tower_api_lookup-user1-{{ test_id }}"
|
||||||
- "AWX-Collection-tests-tower_api_lookup-user2-{{ test_id }}"
|
- "AWX-Collection-tests-tower_api_lookup-user2-{{ test_id }}"
|
||||||
- "AWX-Collection-tests-tower_api_lookup-user3-{{ test_id }}"
|
- "AWX-Collection-tests-tower_api_lookup-user3-{{ test_id }}"
|
||||||
|
|
||||||
- name: Create all of our users
|
- name: Create all of our users
|
||||||
tower_user:
|
tower_user:
|
||||||
username: "{{ item }}"
|
username: "{{ item }}"
|
||||||
is_superuser: true
|
is_superuser: true
|
||||||
password: "{{ test_id }}"
|
password: "{{ test_id }}"
|
||||||
loop: "{{ usernames }}"
|
loop: "{{ usernames }}"
|
||||||
register: user_creation_results
|
register: user_creation_results
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
that:
|
that:
|
||||||
- result is failed
|
- result is failed
|
||||||
- "'The requested object could not be found at' in result.msg"
|
- "'The requested object could not be found at' in result.msg"
|
||||||
|
|
||||||
- name: Load user of a specific name
|
- name: Load user of a specific name
|
||||||
set_fact:
|
set_fact:
|
||||||
users: "{{ query('awx.awx.tower_api', 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }) }}"
|
users: "{{ query('awx.awx.tower_api', 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }) }}"
|
||||||
@@ -61,11 +61,11 @@
|
|||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that: "{{ user_id }} == {{ user_creation_results['results'][0]['id'] }}"
|
that: "{{ user_id }} == {{ user_creation_results['results'][0]['id'] }}"
|
||||||
|
|
||||||
- name: Get a page of users
|
- name: Get a page of users
|
||||||
set_fact:
|
set_fact:
|
||||||
users: "{{ query('awx.awx.tower_api', 'users', query_params={ 'page_size': 2 } ) }}"
|
users: "{{ query('awx.awx.tower_api', 'users', query_params={ 'page_size': 2 } ) }}"
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that: users['results'] | length() == 2
|
that: users['results'] | length() == 2
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
- name: Generate usernames
|
- name: Generate usernames
|
||||||
set_fact:
|
set_fact:
|
||||||
usernames:
|
usernames:
|
||||||
- "AWX-Collection-tests-tower_get_id-user1-{{ test_id }}"
|
- "AWX-Collection-tests-tower_get_id-user1-{{ test_id }}"
|
||||||
- "AWX-Collection-tests-tower_get_id-user2-{{ test_id }}"
|
- "AWX-Collection-tests-tower_get_id-user2-{{ test_id }}"
|
||||||
- "AWX-Collection-tests-tower_get_id-user3-{{ test_id }}"
|
- "AWX-Collection-tests-tower_get_id-user3-{{ test_id }}"
|
||||||
|
|
||||||
- name: Create all of our users
|
- name: Create all of our users
|
||||||
tower_user:
|
tower_user:
|
||||||
username: "{{ item }}"
|
username: "{{ item }}"
|
||||||
is_superuser: true
|
is_superuser: true
|
||||||
password: "{{ test_id }}"
|
password: "{{ test_id }}"
|
||||||
loop: "{{ usernames }}"
|
loop: "{{ usernames }}"
|
||||||
register: user_creation_results
|
register: user_creation_results
|
||||||
|
|
||||||
@@ -25,36 +25,36 @@
|
|||||||
msg: "{{ query('awx.awx.tower_get_id', 'users', 'teams', query_params={}, ) }}"
|
msg: "{{ query('awx.awx.tower_get_id', 'users', 'teams', query_params={}, ) }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- result is failed
|
||||||
- "'ou must pass exactly one endpoint to query' in result.msg"
|
- "'ou must pass exactly one endpoint to query' in result.msg"
|
||||||
|
|
||||||
- name: Try to load invalid endpoint
|
- name: Try to load invalid endpoint
|
||||||
debug:
|
debug:
|
||||||
msg: "{{ query('awx.awx.tower_get_id', 'john', query_params={}, ) }}"
|
msg: "{{ query('awx.awx.tower_get_id', 'john', query_params={}, ) }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- result is failed
|
||||||
- "'The requested object could not be found at' in result.msg"
|
- "'The requested object could not be found at' in result.msg"
|
||||||
|
|
||||||
- name: Get the ID of the admin user
|
- name: Get the ID of the admin user
|
||||||
set_fact:
|
set_fact:
|
||||||
user_id: "{{ query('awx.awx.tower_get_id', 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }) }}"
|
user_id: "{{ query('awx.awx.tower_get_id', 'users', query_params={ 'username' : user_creation_results['results'][0]['item'] }) }}"
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that: "{{ user_id }} == {{ user_creation_results['results'][0]['id'] }}"
|
that: "{{ user_id }} == {{ user_creation_results['results'][0]['id'] }}"
|
||||||
|
|
||||||
- name: Try to get an ID of someone who does not exist
|
- name: Try to get an ID of someone who does not exist
|
||||||
set_fact:
|
set_fact:
|
||||||
failed_user_id: "{{ query('awx.awx.tower_get_id', 'users', query_params={ 'username': 'john jacob jingleheimer schmidt' }) }}"
|
failed_user_id: "{{ query('awx.awx.tower_get_id', 'users', query_params={ 'username': 'john jacob jingleheimer schmidt' }) }}"
|
||||||
register: results
|
register: results
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- results is failed
|
- results is failed
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
too_many_user_ids: " {{ query('awx.awx.tower_get_id', 'users', query_params={ 'username__startswith': 'AWX-Collection-tests-tower_get_id-' }) }}"
|
too_many_user_ids: " {{ query('awx.awx.tower_get_id', 'users', query_params={ 'username__startswith': 'AWX-Collection-tests-tower_get_id-' }) }}"
|
||||||
register: results
|
register: results
|
||||||
ignore_errors: True
|
ignore_errors: true
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
|
|||||||
Reference in New Issue
Block a user