diff --git a/tests/test_oauth2.py b/tests/test_oauth2.py index c5d024eca7f63b9fb58538836d99bba8efcf66f9..1d9751b7faa8494c475948868b9af773217cb81f 100644 --- a/tests/test_oauth2.py +++ b/tests/test_oauth2.py @@ -87,6 +87,10 @@ class TestViews(UffdTestCase): data={'loginname': 'testuser', 'password': 'userpassword'}, follow_redirects=True) state = 'teststate' r = self.client.get(path=url_for('oauth2.authorize', response_type='code', client_id='test', state=state, redirect_uri='http://localhost:5009/callback'), follow_redirects=False) + while True: + if r.status_code != 302 or r.location.startswith('http://localhost:5009/callback'): + break + r = self.client.get(r.location, follow_redirects=False) self.assertEqual(r.status_code, 302) self.assertTrue(r.location.startswith('http://localhost:5009/callback')) args = parse_qs(urlparse(r.location).query)