From 66f90d1401f4a93a114d6f6f5a5bd26ce7ac44dc Mon Sep 17 00:00:00 2001 From: Ricardo Carrillo Cruz Date: Mon, 24 Jul 2017 14:13:51 +0200 Subject: [PATCH] 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 --- .../targets/iosxr_user/tests/cli/basic.yaml | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/test/integration/targets/iosxr_user/tests/cli/basic.yaml b/test/integration/targets/iosxr_user/tests/cli/basic.yaml index 964518b953..83bae0c251 100644 --- a/test/integration/targets/iosxr_user/tests/cli/basic.yaml +++ b/test/integration/targets/iosxr_user/tests/cli/basic.yaml @@ -21,10 +21,26 @@ - '"username" 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: name: ansibletest1 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 provider: "{{ cli }}" register: result @@ -49,7 +65,7 @@ - 'result.changed == true' - '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: users: - name: ansibletest2 @@ -59,6 +75,22 @@ provider: "{{ cli }}" 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: that: - 'result.changed == false'