From 46b0c2f24427266aa4b96695fdf5b449302e6c21 Mon Sep 17 00:00:00 2001 From: juanifioren Date: Tue, 28 Jul 2015 15:54:52 -0300 Subject: [PATCH] Add test to authorize endpoint. --- .../tests/test_authorize_endpoint.py | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/oidc_provider/tests/test_authorize_endpoint.py b/oidc_provider/tests/test_authorize_endpoint.py index 5056749..45367c6 100644 --- a/oidc_provider/tests/test_authorize_endpoint.py +++ b/oidc_provider/tests/test_authorize_endpoint.py @@ -130,7 +130,6 @@ class AuthorizationCodeFlowTestCase(TestCase): # Simulate that the user is logged. request.user = self.user - # Remove the hook, because we want to test default behaviour. response = AuthorizeView.as_view()(request) # Check if hidden inputs exists in the form, @@ -273,3 +272,27 @@ class AuthorizationCodeFlowTestCase(TestCase): client=self.client) self.assertEqual(is_code_ok, True, msg='Code returned is invalid.') + + def test_scope_with_plus(self): + """ + In query string, scope use `+` instead of the space url-encoded. + """ + scope_test = 'openid email profile' + + query_str = urlencode({ + 'client_id': self.client.client_id, + 'response_type': 'code', + 'redirect_uri': self.client.default_redirect_uri, + 'scope': scope_test, + 'state': self.state, + }) + + url = reverse('oidc_provider:authorize') + '?' + query_str + + request = self.factory.get(url) + # Simulate that the user is logged. + request.user = self.user + + response = AuthorizeView.as_view()(request) + + self.assertEqual(scope_test in response.content.decode('utf-8'), True)