Using urllib module to create url.

This commit is contained in:
juanifioren 2015-02-12 16:56:35 -03:00
parent 3df4042155
commit b4fb646f4d

View file

@ -17,14 +17,20 @@ class CodeFlowTestCase(TestCase):
self.client = create_fake_client(response_type='code') self.client = create_fake_client(response_type='code')
def _create_authorize_url(self, response_type, scope=['openid', 'email']): def _create_authorize_url(self, response_type, scope=['openid', 'email']):
url = reverse('openid_provider:authorize') """
url += '?client_id={0}&response_type={1}&scope={2}' \ Generate an OpenID Authentication Request using the fake client data.
'&redirect_uri={3}&state=abcdefg'.format( """
self.client.client_id, path = reverse('openid_provider:authorize')
urllib.quote(response_type),
urllib.quote(' '.join(scope)), query_str = urllib.urlencode({
urllib.quote(self.client.default_redirect_uri), 'client_id': self.client.client_id,
) 'response_type': response_type,
'redirect_uri': self.client.default_redirect_uri,
'scope': ' '.join(scope),
'state': 'abcdefg',
}).replace('+', '%20')
url = path + '?' + query_str
return url return url