File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,27 @@ def tearDown(self):
50
50
51
51
52
52
class TestAuthorizationCodeView (BaseTest ):
53
+ def test_skip_authorization_completely (self ):
54
+ """
55
+ If application.skip_authorization = True, should skip the authorization page.
56
+ """
57
+ self .client .login (username = "test_user" , password = "123456" )
58
+ self .application .skip_authorization = True
59
+ self .application .save ()
60
+
61
+ query_string = urlencode ({
62
+ 'client_id' : self .application .client_id ,
63
+ 'response_type' : 'code' ,
64
+ 'state' : 'random_state_string' ,
65
+ 'scope' : 'read write' ,
66
+ 'redirect_uri' : 'http://example.it' ,
67
+ })
68
+ url = "{url}?{qs}" .format (url = reverse ('oauth2_provider:authorize' ), qs = query_string )
69
+
70
+ response = self .client .get (url )
71
+ self .assertEqual (response .status_code , 302 )
72
+
73
+
53
74
def test_pre_auth_invalid_client (self ):
54
75
"""
55
76
Test error for an invalid client_id with response_type: code
Original file line number Diff line number Diff line change @@ -142,12 +142,13 @@ def test_post_auth_allow(self):
142
142
self .assertIn ('access_token=' , response ['Location' ])
143
143
self .assertIn ('state=random_state_string' , response ['Location' ])
144
144
145
- @mock .patch ('oauth2_provider.views.base.AuthorizationView.skip_authorization_completely' , True )
146
145
def test_skip_authorization_completely (self ):
147
146
"""
148
- If skip_authorization_completely = True, should skip the authorization page.
147
+ If application.skip_authorization = True, should skip the authorization page.
149
148
"""
150
149
self .client .login (username = "test_user" , password = "123456" )
150
+ self .application .skip_authorization = True
151
+ self .application .save ()
151
152
152
153
query_string = urlencode ({
153
154
'client_id' : self .application .client_id ,
You can’t perform that action at this time.
0 commit comments