GoogleOAuthTest: Refactor parameter encoding.

This commit is contained in:
Tim Abbott 2017-04-27 15:22:58 -07:00
parent 8ad3a8bc9a
commit 8b78f22660
1 changed files with 4 additions and 1 deletions

View File

@ -663,8 +663,11 @@ class GoogleOAuthTest(ZulipTestCase):
def google_oauth2_test(self, token_response, account_response, subdomain=None):
# type: (ResponseMock, ResponseMock, Optional[str]) -> HttpResponse
url = "/accounts/login/google/send/"
params = {}
if subdomain is not None:
url += "?subdomain=" + subdomain
params['subdomain'] = subdomain
if len(params) > 0:
url += "?%s" % (urllib.parse.urlencode(params))
result = self.client_get(url)
self.assertEqual(result.status_code, 302)