Skip to content

Commit

Permalink
fix nxos_user integration test (ansible#27619)
Browse files Browse the repository at this point in the history
Signed-off-by: Trishna Guha <[email protected]>
  • Loading branch information
trishnaguha authored Aug 2, 2017
1 parent 20b0716 commit 9304d6c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 14 deletions.
2 changes: 2 additions & 0 deletions test/integration/targets/nxos_user/tasks/nxapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- feature nxapi
- nxapi http port 80
provider: "{{ cli }}"
timeout: 100

- name: run test case
include: "{{ test_case_to_run }}"
Expand All @@ -26,3 +27,4 @@
lines:
- no feature nxapi
provider: "{{ cli }}"
timeout: 100
28 changes: 21 additions & 7 deletions test/integration/targets/nxos_user/tests/cli/basic.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
---
- name: Remove old entries of user
nxos_user:
aggregate:
- name: ansibletest1
- name: ansibletest2
- name: ansibletest3
state: absent
provider: "{{ cli }}"

# Start tests
- name: Create user
nxos_user:
name: netend
name: ansibletest1
roles: network-operator
state: present
provider: "{{ cli }}"
Expand All @@ -10,13 +20,14 @@
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username netend role network-operator"]'
- '"username" in result.commands[0]'
- '"role network-operator" in result.commands[1]'

- name: Collection of users
nxos_user:
aggregate:
- name: test1
- name: test2
- name: ansibletest2
- name: ansibletest3
state: present
roles: network-admin
provider: "{{ cli }}"
Expand All @@ -25,15 +36,18 @@
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username test1 role network-admin", "username test2 role network-admin"]'

- name: tearDown
nxos_user:
purge: yes
aggregate:
- name: ansibletest1
- name: ansibletest2
- name: ansibletest3
state: absent
provider: "{{ cli }}"
register: result

- assert:
that:
- 'result.changed == true'
- 'result.commands == ["no username netend", "no username test1", "no username test2"]'
- '"no username" in result.commands[0]'
28 changes: 21 additions & 7 deletions test/integration/targets/nxos_user/tests/nxapi/basic.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
---
- name: Remove old entries of user
nxos_user:
aggregate:
- name: ansibletest1
- name: ansibletest2
- name: ansibletest3
state: absent
provider: "{{ nxapi }}"

# Start tests
- name: Create user
nxos_user:
name: netend
name: ansibletest1
roles: network-operator
state: present
provider: "{{ nxapi }}"
Expand All @@ -10,13 +20,14 @@
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username netend role network-operator"]'
- '"username" in result.commands[0]'
- '"role network-operator" in result.commands[1]'

- name: Collection of users
nxos_user:
aggregate:
- name: test1
- name: test2
- name: ansibletest2
- name: ansibletest3
state: present
roles: network-admin
provider: "{{ nxapi }}"
Expand All @@ -25,15 +36,18 @@
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username test1 role network-admin", "username test2 role network-admin"]'

- name: tearDown
nxos_user:
purge: yes
aggregate:
- name: ansibletest1
- name: ansibletest2
- name: ansibletest3
state: absent
provider: "{{ nxapi }}"
register: result

- assert:
that:
- 'result.changed == true'
- 'result.commands == ["no username netend", "no username test1", "no username test2"]'
- '"no username" in result.commands[0]'

0 comments on commit 9304d6c

Please sign in to comment.