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
29-
26+ @pytest .mark .skip (
27+ "This test requires a high rate of request in a short time "
28+ "and is only enabled if checked on purpose. "
29+ "It is skipped to avoid unnecesary system load"
30+ )
31+ def test_rate_limit_logged (self , caplog : pytest .LogCaptureFixture ) -> None :
32+ """This test tries to send many request in order to log a "rate limit message.
33+
34+ it will only work if your client sends these requests fast enough.
35+
36+ Args:
37+ caplog: _description_
38+ """
3039 with caplog .at_level (logging .INFO , logger = "ratelimitedsession" ):
31- for _i in range (750 ):
32- self .api .get_songs ( song_id = SAMPLE_SONG_ID )
40+ for _i in range (1000 ):
41+ self .api .get_calendars ( )
3342 EXPECTED_MESSAGES = [
3443 "rate limit reached - waiting 15 sec before repeating request"
3544 ]
3645
37- assert caplog . messages == EXPECTED_MESSAGES
46+ assert all ( message in EXPECTED_MESSAGES for message in caplog . messages )
You can’t perform that action at this time.
0 commit comments