From 29b3e81dd4efafbb6c94f75c5f492b148af1b5bc Mon Sep 17 00:00:00 2001 From: Mateusz Mandera Date: Fri, 6 Aug 2021 11:11:08 +0200 Subject: [PATCH] test_external: Assert that requests don't get rate limited too soon. This assertion was missing in do_test_hit_ratelimits, allowing a test to pass even if the requests started being blocked sooner than expected. --- zerver/tests/test_external.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zerver/tests/test_external.py b/zerver/tests/test_external.py index 880e07e579..3e8c522243 100644 --- a/zerver/tests/test_external.py +++ b/zerver/tests/test_external.py @@ -155,6 +155,8 @@ class RateLimitTests(ZulipTestCase): for i in range(6): with mock.patch("time.time", return_value=(start_time + i * 0.1)): result = request_func() + if i < 5: + self.assertNotEqual(result.status_code, 429) assert_func(result)