From: Tatjana Dehler Date: Wed, 9 Oct 2019 13:39:31 +0000 (+0200) Subject: mgr/dashboard: reset login to admin user X-Git-Tag: v15.1.0~1275^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a14163a589b7fdd6db377b4f58f2ec75d1130639;p=ceph-ci.git mgr/dashboard: reset login to admin user After logging in with a separate testuser, especially a read-only user, we need to reset the login to the admin user. This is important in order to be able to continue with further tests. If not doing so further tests might fail with the following error response: {"status": "401 Unauthorized", "detail": "You are not authorized to access that resource", ...} Fixes: https://tracker.ceph.com/issues/42226, https://tracker.ceph.com/issues/42227 Signed-off-by: Tatjana Dehler --- diff --git a/qa/tasks/mgr/dashboard/test_user.py b/qa/tasks/mgr/dashboard/test_user.py index a8f04bae35d..860bc8bf45b 100644 --- a/qa/tasks/mgr/dashboard/test_user.py +++ b/qa/tasks/mgr/dashboard/test_user.py @@ -23,6 +23,12 @@ class UserTest(DashboardTestCase): data['enabled'] = enabled cls._post("/api/user", data) + @classmethod + def _reset_login_to_admin(cls, username): + cls.logout() + cls.delete_user(username) + cls.login('admin', 'admin') + def test_crud_user(self): self._create_user(username='user1', password='mypassword10#', @@ -64,7 +70,7 @@ class UserTest(DashboardTestCase): def test_crd_disabled_user(self): self._create_user(username='klara', - password='123456789', + password='mypassword10#', name='Klara Musterfrau', email='klara@musterfrau.com', roles=['administrator'], @@ -178,7 +184,7 @@ class UserTest(DashboardTestCase): }) self.assertStatus(400) self.assertError(code='pwd-must-not-be-last-one', component='user') - self.delete_user('test1') + self._reset_login_to_admin('test1') def test_change_password_contains_username(self): self.create_user('test1', 'mypassword10#', ['read-only']) @@ -189,7 +195,7 @@ class UserTest(DashboardTestCase): }) self.assertStatus(400) self.assertError(code='pwd-must-not-contain-username', component='user') - self.delete_user('test1') + self._reset_login_to_admin('test1') def test_change_password_contains_forbidden_words(self): self.create_user('test1', 'mypassword10#', ['read-only']) @@ -200,7 +206,7 @@ class UserTest(DashboardTestCase): }) self.assertStatus(400) self.assertError(code='pwd-must-not-contain-forbidden-keywords', component='user') - self.delete_user('test1') + self._reset_login_to_admin('test1') def test_change_password_contains_sequential_characters(self): self.create_user('test1', 'mypassword10#', ['read-only']) @@ -211,7 +217,7 @@ class UserTest(DashboardTestCase): }) self.assertStatus(400) self.assertError(code='pwd-must-not-contain-sequential-chars', component='user') - self.delete_user('test1') + self._reset_login_to_admin('test1') def test_change_password_contains_repetetive_characters(self): self.create_user('test1', 'mypassword10#', ['read-only']) @@ -222,7 +228,7 @@ class UserTest(DashboardTestCase): }) self.assertStatus(400) self.assertError(code='pwd-must-not-contain-repetitive-chars', component='user') - self.delete_user('test1') + self._reset_login_to_admin('test1') def test_change_password(self): self.create_user('test1', 'mypassword10#', ['read-only'])