From e7e7d14250e8b54bc2ac86f5980e56106c901453 Mon Sep 17 00:00:00 2001 From: Elisa Anguita Date: Thu, 9 Jan 2025 11:44:46 -0300 Subject: [PATCH] test(pacer): test rate limiting --- cl/search/tests/test_pacer_bulk_fetch.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cl/search/tests/test_pacer_bulk_fetch.py b/cl/search/tests/test_pacer_bulk_fetch.py index 1998cbc104..c5ee60e6e6 100644 --- a/cl/search/tests/test_pacer_bulk_fetch.py +++ b/cl/search/tests/test_pacer_bulk_fetch.py @@ -125,12 +125,24 @@ def test_rate_limiting( mock_chain = MagicMock() mock_chain_builder.return_value = mock_chain + rate_limit = "10/m" self.command.handle( min_page_count=1000, + rate_limit=rate_limit, username=self.user.username, testing=True, ) + # Verify the rate limit was passed correctly + for call in mock_chain_builder.call_args_list: + with self.subTest(call=call): + _, kwargs = call + self.assertEqual( + kwargs.get("rate_limit"), + rate_limit, + "Rate limit should be passed to chain builder", + ) + self.assertEqual( mock_throttle.call_count, self.big_docs_count,