google_oauth2_test: Pass headers in all requests.

Currently we only pass headers in the first client_get call but
sometimes the effective request which reaches the view is through
a later call to the client_get in this function. Due to which
headers are not passed.
This commit is contained in:
Umair Khan
2017-06-16 09:49:25 +05:00
committed by Tim Abbott
parent 1ce8258f2e
commit b9c69004e4

View File

@@ -766,7 +766,7 @@ class GoogleOAuthTest(ZulipTestCase):
return result
# Now do the /google/send/ request
result = self.client_get(result.url)
result = self.client_get(result.url, **headers)
self.assertEqual(result.status_code, 302)
if 'google' not in result.url:
return result
@@ -779,7 +779,7 @@ class GoogleOAuthTest(ZulipTestCase):
with mock.patch("requests.post", return_value=token_response), (
mock.patch("requests.get", return_value=account_response)):
result = self.client_get("/accounts/login/google/done/",
dict(state=csrf_state))
dict(state=csrf_state), **headers)
return result
class GoogleSubdomainLoginTest(GoogleOAuthTest):