Make exponential back off test try multiple times
Slower runtime environments require multiple calls before we hit the 429
This commit is contained in:
parent
259caa4577
commit
a18c4dd210
1 changed files with 14 additions and 2 deletions
|
@ -95,7 +95,9 @@ class EndpointTestCase(unittest.TestCase):
|
||||||
url = EndpointTestCase._add_csrf(url)
|
url = EndpointTestCase._add_csrf(url)
|
||||||
|
|
||||||
rv = self.app.post(url, headers=headers, data=form)
|
rv = self.app.post(url, headers=headers, data=form)
|
||||||
self.assertEquals(rv.status_code, expected_code)
|
if expected_code is not None:
|
||||||
|
self.assertEquals(rv.status_code, expected_code)
|
||||||
|
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
def login(self, username, password):
|
def login(self, username, password):
|
||||||
|
@ -330,7 +332,17 @@ class OAuthTestCase(EndpointTestCase):
|
||||||
# Try without the client id being in the whitelist a few times, making sure we eventually get rate limited.
|
# Try without the client id being in the whitelist a few times, making sure we eventually get rate limited.
|
||||||
headers = dict(authorization='Basic ' + base64.b64encode('devtable:invalidpassword'))
|
headers = dict(authorization='Basic ' + base64.b64encode('devtable:invalidpassword'))
|
||||||
self.postResponse('web.authorize_application', headers=headers, form=form, with_csrf=False, expected_code=401)
|
self.postResponse('web.authorize_application', headers=headers, form=form, with_csrf=False, expected_code=401)
|
||||||
self.postResponse('web.authorize_application', headers=headers, form=form, with_csrf=False, expected_code=429)
|
|
||||||
|
counter = 0
|
||||||
|
while True:
|
||||||
|
r = self.postResponse('web.authorize_application', headers=headers, form=form, with_csrf=False, expected_code=None)
|
||||||
|
self.assertNotEquals(200, r.status_code)
|
||||||
|
counter = counter + 1
|
||||||
|
if counter > 5:
|
||||||
|
self.fail('Exponential backoff did not fire')
|
||||||
|
|
||||||
|
if r.status_code == 429:
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
class KeyServerTestCase(EndpointTestCase):
|
class KeyServerTestCase(EndpointTestCase):
|
||||||
|
|
Reference in a new issue