Skip to content

Commit cd3e4db

Browse files
[fix] Fix the flaky tests for personal access token expiration
Fix the flaky test which can fail if the seconds of the expiration is not equal. Since the granularity of the expiration, only checking the date will suffice.
1 parent edbe7ee commit cd3e4db

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

web/tests/functional/authentication/test_authentication.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ def test_privileged_access(self):
110110
name = "name"
111111
expiration = 7
112112
exp_expiry_date = datetime.today() + timedelta(days=expiration)
113-
exp_expiry_date_str = exp_expiry_date.strftime("%Y-%m-%d %H:%M:%S")
113+
exp_expiry_date_str = exp_expiry_date.strftime("%Y-%m-%d")
114114
personal_token = authd_auth_client.newPersonalAccessToken(
115115
name, description, expiration)
116-
act_expiry_date_str = personal_token.expiration.split('.')[0]
116+
act_expiry_date_str = personal_token.expiration.split()[0]
117117
token = personal_token.token
118118
self.assertEqual(personal_token.description, description)
119119
self.assertEqual(act_expiry_date_str, exp_expiry_date_str)
@@ -124,7 +124,7 @@ def test_privileged_access(self):
124124
self.assertEqual(personal_tokens[0].token, "")
125125
self.assertEqual(personal_tokens[0].name, name)
126126
self.assertEqual(personal_tokens[0].description, description)
127-
pers_token_expiry_str = personal_tokens[0].expiration.split('.')[0]
127+
pers_token_expiry_str = personal_tokens[0].expiration.split()[0]
128128
self.assertEqual(pers_token_expiry_str, exp_expiry_date_str)
129129

130130
auth_client = env.setup_auth_client(self._test_workspace,

0 commit comments

Comments
 (0)