tests: hit harder on tracking codes to be sure to trigger rate limit

This commit is contained in:
Frédéric Péters 2020-04-03 10:34:53 +02:00
parent d86bfe5966
commit 2b14cc2c28
1 changed files with 4 additions and 2 deletions

View File

@ -1126,6 +1126,8 @@ def test_tracking_code_search_rate_limit(app):
settings.TEMPLATE_VARS['is_portal_agent'] = True
for i in range(3):
assert app.get('/api/search/tracking-code/?q=BBCCDDFF').json.get('err') == 0
for i in range(3): # make sure we hit ratelimit
app.get('/api/search/tracking-code/?q=BBCCDDFF')
assert app.get('/api/search/tracking-code/?q=BBCCDDFF').json.get('err') == 1
Page.objects.all().delete()
@ -1135,7 +1137,7 @@ def test_tracking_code_search_rate_limit(app):
cell.save()
resp = app.get('/')
for i in range(3): # make sure we hit ratelimit
for i in range(3): # make sure we hit ratelimit
app.get('/api/search/tracking-code/?q=BBCCDDFF')
resp.form['code'] = 'FOOBAR'
resp = resp.form.submit()
@ -1144,7 +1146,7 @@ def test_tracking_code_search_rate_limit(app):
assert '<li class="error">Looking up tracking code is currently rate limited.</li>' in resp.text
resp = app.get('/')
for i in range(3): # make sure we hit ratelimit
for i in range(3): # make sure we hit ratelimit
app.get('/api/search/tracking-code/?q=BBCCDDFF')
resp.form['code'] = 'FOOBAR'
resp.form['url'] = 'http://example.org/'