@@ -37,6 +37,7 @@ def setUp(self):
3737 self .application .save ()
3838
3939 oauth2_settings ._SCOPES = ['read' , 'write' ]
40+ oauth2_settings ._DEFAULT_SCOPES = ['read' ]
4041
4142 def tearDown (self ):
4243 self .application .delete ()
@@ -45,6 +46,26 @@ def tearDown(self):
4546
4647
4748class TestImplicitAuthorizationCodeView (BaseTest ):
49+ def test_pre_auth_valid_client_default_scopes (self ):
50+ """
51+ Test response for a valid client_id with response_type: token and default_scopes
52+ """
53+ self .client .login (username = "test_user" , password = "123456" )
54+ query_string = urlencode ({
55+ 'client_id' : self .application .client_id ,
56+ 'response_type' : 'token' ,
57+ 'state' : 'random_state_string' ,
58+ 'redirect_uri' : 'http://example.it' ,
59+ })
60+
61+ url = "{url}?{qs}" .format (url = reverse ('oauth2_provider:authorize' ), qs = query_string )
62+ response = self .client .get (url )
63+ self .assertEqual (response .status_code , 200 )
64+
65+ self .assertIn ("form" , response .context )
66+ form = response .context ["form" ]
67+ self .assertEqual (form ['scope' ].value (), 'read' )
68+
4869 def test_pre_auth_valid_client (self ):
4970 """
5071 Test response for a valid client_id with response_type: token
0 commit comments