From 9d0848772311978c3046c17f3ce51e9571983fbe Mon Sep 17 00:00:00 2001 From: Taseer Ahmed Date: Tue, 21 Aug 2018 21:19:23 +0500 Subject: [PATCH] Add tests to verify 'password update' feature The tests consist of changing the admin users password, and through API, verify the expected behaviour. This includes querying the API with the old password and expecting 401/unauthorized error, and then querying with the new password and expecting a 200 response. JIRA: INTPAK-16 Change-Id: Ia8e49be488604604d7cc14551db11cc269485df3 Signed-off-by: Taseer Ahmed --- tests/test-odl-users.yaml | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/test-odl-users.yaml b/tests/test-odl-users.yaml index fd0d357..0fb4fd2 100644 --- a/tests/test-odl-users.yaml +++ b/tests/test-odl-users.yaml @@ -102,3 +102,58 @@ assert: that: - "delete_without_username.msg == 'Username not provided'" + + - name: assert that API responds with default admin password + uri: + url: http://localhost:8181/auth/v1/users + url_username: admin + url_password: admin + status_code: 200 + register: api_responsive_default_password + until: api_responsive_default_password.status == 200 + retries: 5 + delay: 5 + + - name: assert that API fails with new password before changing + uri: + url: http://localhost:8181/auth/v1/users + url_username: admin + url_password: temp + status_code: 401 + register: api_failure_before_pass_change + until: api_failure_before_pass_change.status == 401 + retries: 5 + delay: 5 + + - name: update admin password + odl_usermod: + username: admin + password: temp + state: update + + - name: restart odl service + service: + name: opendaylight + state: restarted + + - name: assert API fails with old password + uri: + url: http://localhost:8181/auth/v1/users/ + url_username: admin + url_password: admin + status_code: 401 + register: old_admin_password_failure + until: old_admin_password_failure.status == 401 + retries: 10 + delay: 10 + + - name: assert API responds with new password + uri: + url: http://localhost:8181/auth/v1/users/ + url_username: admin + url_password: temp + status_code: 200 + register: new_admin_password_success + until: new_admin_password_success.status == 200 + retries: 5 + delay: 5 \ No newline at end of file -- 2.36.6