tests: test rate limiting with freezegun (#38180)
This commit is contained in:
parent
b81166887d
commit
e508d436ab
|
@ -1499,7 +1499,7 @@ def test_form_tracking_code(pub, nocache):
|
|||
assert resp.location == 'http://example.net/test/%s' % formdata_id
|
||||
resp = resp.follow()
|
||||
|
||||
def test_form_tracking_code_rate_limit(pub):
|
||||
def test_form_tracking_code_rate_limit(pub, freezer):
|
||||
pub.load_site_options()
|
||||
if not pub.site_options.has_section('options'):
|
||||
pub.site_options.add_section('options')
|
||||
|
@ -1508,13 +1508,14 @@ def test_form_tracking_code_rate_limit(pub):
|
|||
pub.site_options.write(fd)
|
||||
|
||||
# twice
|
||||
freezer.move_to('2018-12-01T00:00:00')
|
||||
get_app(pub).get('/code/ABC/load', status=404)
|
||||
get_app(pub).get('/code/ABC/load', status=404)
|
||||
# and out
|
||||
get_app(pub).get('/code/ABC/load', status=403)
|
||||
get_app(pub).get('/code/ABC/load', status=403)
|
||||
# wait two second
|
||||
time.sleep(2)
|
||||
freezer.move_to('2018-12-01T00:00:02')
|
||||
# and ok again
|
||||
get_app(pub).get('/code/ABC/load', status=404)
|
||||
|
||||
|
|
Loading…
Reference in New Issue