mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-17 19:52:25 +03:00
return snippet of test
This commit is contained in:
parent
02b338f2e3
commit
e8c6ad7f77
|
@ -179,6 +179,19 @@ class ThrottlingTests(TestCase):
|
||||||
assert response.status_code == 429
|
assert response.status_code == 429
|
||||||
assert int(response['retry-after']) == 60
|
assert int(response['retry-after']) == 60
|
||||||
|
|
||||||
|
previous_rate = User3SecRateThrottle.rate
|
||||||
|
try:
|
||||||
|
User3SecRateThrottle.rate = '1/sec'
|
||||||
|
|
||||||
|
for dummy in range(24):
|
||||||
|
response = MockView_DoubleThrottling.as_view()(request)
|
||||||
|
|
||||||
|
assert response.status_code == 429
|
||||||
|
assert int(response['retry-after']) == 60
|
||||||
|
finally:
|
||||||
|
# reset
|
||||||
|
User3SecRateThrottle.rate = previous_rate
|
||||||
|
|
||||||
def test_request_throttling_with_amount_of_period(self):
|
def test_request_throttling_with_amount_of_period(self):
|
||||||
self.set_throttle_timer(MockView_1RequestIn2SecondThrottling, 0)
|
self.set_throttle_timer(MockView_1RequestIn2SecondThrottling, 0)
|
||||||
request = self.factory.get('/')
|
request = self.factory.get('/')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user