Give a safer buffer for clearing the rate limiting

The rate limiter counts requests in a 5-minute window.  To be sure we
aren't hitting edge cases, make the future requests 6 minutes plus 1
second in the future.
This commit is contained in:
Ned Batchelder
2019-05-16 14:41:28 -04:00
parent 64c47856dd
commit 4a1154a7ca

View File

@@ -1749,8 +1749,8 @@ class RegistrationCodeRedemptionCourseEnrollment(SharedModuleStoreTestCase):
response = self.client.post(url)
self.assertEquals(response.status_code, 403)
# now reset the time to 5 mins from now in future in order to unblock
reset_time = datetime.now(UTC) + timedelta(seconds=300)
# now reset the time to 6 mins from now in future in order to unblock
reset_time = datetime.now(UTC) + timedelta(seconds=361)
with freeze_time(reset_time):
response = self.client.post(url)
self.assertEquals(response.status_code, 404)
@@ -1773,8 +1773,8 @@ class RegistrationCodeRedemptionCourseEnrollment(SharedModuleStoreTestCase):
response = self.client.get(url)
self.assertEquals(response.status_code, 403)
# now reset the time to 5 mins from now in future in order to unblock
reset_time = datetime.now(UTC) + timedelta(seconds=300)
# now reset the time to 6 mins from now in future in order to unblock
reset_time = datetime.now(UTC) + timedelta(seconds=361)
with freeze_time(reset_time):
response = self.client.get(url)
self.assertEquals(response.status_code, 404)