From e8c6ad7f7763aeaa7bf6d343fdae052e156b5ba5 Mon Sep 17 00:00:00 2001 From: abulaysov Date: Mon, 18 Mar 2024 03:10:58 +0300 Subject: [PATCH] return snippet of test --- tests/test_throttling.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_throttling.py b/tests/test_throttling.py index 60ce24cae..f84f5aa4b 100644 --- a/tests/test_throttling.py +++ b/tests/test_throttling.py @@ -179,6 +179,19 @@ class ThrottlingTests(TestCase): assert response.status_code == 429 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): self.set_throttle_timer(MockView_1RequestIn2SecondThrottling, 0) request = self.factory.get('/')