summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGage Hugo <gagehugo@gmail.com>2019-09-24 11:34:37 -0500
committerGage Hugo <gagehugo@gmail.com>2020-03-18 15:06:38 +0000
commit6525203c1af9ecdf7c23af3f25e45f0db9f6fed2 (patch)
tree61e7a15ab1fdc36062b8a93ce124b1281abd38d1
parent62cd34d40d85af85b34146f9827da3414c09418f (diff)
downloadkeystone-6525203c1af9ecdf7c23af3f25e45f0db9f6fed2.tar.gz
Change time faking for totp test
This change moves the time mocking from using freezegun to using oslo.utils TimeFixture for the unit test test_with_passcode_in_previous_windows_extended, which was occasionally failing with 401 errors due to the totp creation time not properly be faked with 4 extended windows. Closes-Bug: #1843464 Change-Id: I3aefd99907fbc2d03538c9814f7279b282715679
-rw-r--r--keystone/tests/unit/test_v3_auth.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/keystone/tests/unit/test_v3_auth.py b/keystone/tests/unit/test_v3_auth.py
index e9debce63..585f57766 100644
--- a/keystone/tests/unit/test_v3_auth.py
+++ b/keystone/tests/unit/test_v3_auth.py
@@ -5304,9 +5304,9 @@ class TestAuthTOTP(test_v3.RestfulTestCase):
secret = creds[-1]['blob']
past = datetime.datetime.utcnow() - datetime.timedelta(minutes=2)
- with freezegun.freeze_time(past):
- auth_data = self._make_auth_data_by_id(
- totp._generate_totp_passcodes(secret)[0])
+ self.useFixture(fixture.TimeFixture(past))
+ auth_data = self._make_auth_data_by_id(
+ totp._generate_totp_passcodes(secret)[0])
# Stop the clock otherwise there is a chance of auth failure due to
# getting a different TOTP between the call here and the call in the