Add update_password always and update_password on_create tests to iosxr_user (#27230)

* Add idempotency test to delete aggregate of iosxr users

* Add update_password always and on_create asserts to iosxr_user
This commit is contained in:
Ricardo Carrillo Cruz 2017-07-24 14:13:51 +02:00 committed by GitHub
parent 4ad022b622
commit 66f90d1401

View file

@ -21,10 +21,26 @@
- '"username" in result.commands[0]' - '"username" in result.commands[0]'
- '"secret" in result.commands[0]' - '"secret" in result.commands[0]'
- name: Add user again (Idempotent) - name: Create user with update_password always (not idempotent)
iosxr_user: iosxr_user:
name: ansibletest1 name: ansibletest1
password: test password: test
update_password: always
state: present
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"username" in result.commands[0]'
- '"secret" in result.commands[0]'
- name: Create user again with update_password on_create (idempotent)
iosxr_user:
name: ansibletest1
password: test
update_password: on_create
state: present state: present
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result
@ -49,7 +65,7 @@
- 'result.changed == true' - 'result.changed == true'
- 'result.commands == ["username ansibletest2 group sysadmin", "username ansibletest3 group sysadmin"]' - 'result.commands == ["username ansibletest2 group sysadmin", "username ansibletest3 group sysadmin"]'
- name: Add collection of users again (Idempotent) - name: Add collection of users again with update_password always (not idempotent)
iosxr_user: iosxr_user:
users: users:
- name: ansibletest2 - name: ansibletest2
@ -59,6 +75,22 @@
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username ansibletest2 group sysadmin", "username ansibletest3 group sysadmin"]'
- name: Add collection of users again with update_password on_create (idempotent)
iosxr_user:
users:
- name: ansibletest2
- name: ansibletest3
update_password: on_create
state: present
group: sysadmin
provider: "{{ cli }}"
register: result
- assert: - assert:
that: that:
- 'result.changed == false' - 'result.changed == false'