Add tests to verify 'password update' feature 63/75363/3
authorTaseer Ahmed <taseer94@gmail.com>
Tue, 21 Aug 2018 16:19:23 +0000 (21:19 +0500)
committerTaseer Ahmed <taseer94@gmail.com>
Sat, 25 Aug 2018 06:24:48 +0000 (11:24 +0500)
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 <taseer94@gmail.com>
tests/test-odl-users.yaml

index fd0d357f88ef9f3b89d2a923620159c8d2613f0d..0fb4fd2966191bf53726af464651960220f6089b 100644 (file)
       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