tests: adapt rate limit test for jenkins being sometimes too slow
This commit is contained in:
parent
dae1829c8c
commit
f76434a7ed
|
@ -1413,13 +1413,23 @@ def test_form_tracking_code(pub, nocache):
|
|||
resp = resp.follow()
|
||||
|
||||
def test_form_tracking_code_rate_limit(pub):
|
||||
# three errors
|
||||
get_app(pub).get('/code/ABC/load', status=404)
|
||||
pub.load_site_options()
|
||||
if not pub.site_options.has_section('options'):
|
||||
pub.site_options.add_section('options')
|
||||
pub.site_options.set('options', 'rate-limit', '2/2s')
|
||||
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
|
||||
pub.site_options.write(fd)
|
||||
|
||||
# twice
|
||||
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)
|
||||
# and ok again
|
||||
get_app(pub).get('/code/ABC/load', status=404)
|
||||
|
||||
def test_form_tracking_code_as_user(pub, nocache):
|
||||
user = create_user(pub)
|
||||
|
|
Loading…
Reference in New Issue