Skip to content

Commit

Permalink
test(pacer): test rate limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
elisa-a-v committed Jan 9, 2025
1 parent 2915cb9 commit e7e7d14
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cl/search/tests/test_pacer_bulk_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e7e7d14

Please sign in to comment.