]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix failing user tests 32461/head
authorTatjana Dehler <tdehler@suse.com>
Thu, 2 Jan 2020 12:22:48 +0000 (13:22 +0100)
committerTatjana Dehler <tdehler@suse.com>
Tue, 7 Jan 2020 10:56:52 +0000 (11:56 +0100)
Choose another future_date_1 date (9 days instead of 10) to
make sure the expiration date will be between future_date_1
and future_date_2. Otherwise the expiration date might be
equal to future_date_1.
Also wait for 10 seconds before the password refresh in
test_pwd_expiration_date_update to prevent date equality.

Fixes: https://tracker.ceph.com/issues/43431
Signed-off-by: Tatjana Dehler <tdehler@suse.com>
qa/tasks/mgr/dashboard/test_user.py

index 115e554ec11db46c26b95c398cf2725c16fa842c..de3fcfbe4f6fe7858902ef97c2fa388f0a4256c8 100644 (file)
@@ -341,7 +341,7 @@ class UserTest(DashboardTestCase):
         self.assertError(code='pwd_past_expiration_date', component='user')
 
     def test_create_with_default_expiration_date(self):
-        future_date_1 = datetime.utcnow() + timedelta(days=10)
+        future_date_1 = datetime.utcnow() + timedelta(days=9)
         future_date_1 = int(time.mktime(future_date_1.timetuple()))
         future_date_2 = datetime.utcnow() + timedelta(days=11)
         future_date_2 = int(time.mktime(future_date_2.timetuple()))
@@ -375,6 +375,7 @@ class UserTest(DashboardTestCase):
         user_1 = self._get('/api/user/user1')
         self.assertStatus(200)
 
+        time.sleep(10)
         self.login('user1', 'mypassword10#')
         self._post('/api/user/user1/change_password', {
             'old_password': 'mypassword10#',
@@ -383,9 +384,9 @@ class UserTest(DashboardTestCase):
         self.assertStatus(200)
         self._reset_login_to_admin()
 
-        user_2 = self._get('/api/user/user1')
+        user_1_pwd_changed = self._get('/api/user/user1')
         self.assertStatus(200)
-        self.assertLess(user_1['pwdExpirationDate'], user_2['pwdExpirationDate'])
+        self.assertLess(user_1['pwdExpirationDate'], user_1_pwd_changed['pwdExpirationDate'])
 
         self._delete('/api/user/user1')
         self._ceph_cmd(['dashboard', 'set-user-pwd-expiration-span', '0'])