Merge "Change time faking for totp test"

This commit is contained in:
Zuul 2020-03-24 19:25:53 +00:00 committed by Gerrit Code Review
commit bf9f5dec55
1 changed files with 3 additions and 3 deletions

View File

@ -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