File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323class TestsRateLimitedSession (TestsChurchToolsApiAbstract ):
2424 """Test for Rate limits."""
2525
26- def test_no_rate_limit (self , caplog : pytest .LogCaptureFixture ) -> None :
27- """Reference time for 250 requests without throttle using google.com."""
28- SAMPLE_SONG_ID = 408
26+ def test_rate_limit_logged (self , caplog : pytest .LogCaptureFixture ) -> None :
27+ """This test tries to send many request in order to log a "rate limit message.
2928
29+ it will only work if your client sends these requests fast enough.
30+
31+ Args:
32+ caplog: _description_
33+ """
3034 with caplog .at_level (logging .INFO , logger = "ratelimitedsession" ):
31- for _i in range (750 ):
32- self .api .get_songs ( song_id = SAMPLE_SONG_ID )
35+ for _i in range (1500 ):
36+ self .api .get_calendars ( )
3337 EXPECTED_MESSAGES = [
3438 "rate limit reached - waiting 15 sec before repeating request"
3539 ]
3640
37- assert caplog . messages == EXPECTED_MESSAGES
41+ assert all ( message in EXPECTED_MESSAGES for message in caplog . messages )
You can’t perform that action at this time.
0 commit comments