Merge "Change time faking for totp test" into stable/train

This commit is contained in:
Zuul 2020-05-20 00:26:52 +00:00 committed by Gerrit Code Review
commit b74e95c27f
1 changed files with 3 additions and 3 deletions

View File

@ -5306,9 +5306,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