@@ -37,6 +37,7 @@ def setUp(self):
37
37
self .application .save ()
38
38
39
39
oauth2_settings ._SCOPES = ['read' , 'write' ]
40
+ oauth2_settings ._DEFAULT_SCOPES = ['read' ]
40
41
41
42
def tearDown (self ):
42
43
self .application .delete ()
@@ -45,6 +46,26 @@ def tearDown(self):
45
46
46
47
47
48
class 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
+
48
69
def test_pre_auth_valid_client (self ):
49
70
"""
50
71
Test response for a valid client_id with response_type: token
0 commit comments