1212from ..compat import urlparse , parse_qs , urlencode , get_user_model
1313from ..models import get_application_model , Grant , AccessToken
1414from ..settings import oauth2_settings
15- from ..oauth2_validators import OAuth2Validator
1615from ..views import ProtectedResourceView
1716
1817from .test_utils import TestCaseUtils
@@ -35,7 +34,7 @@ def setUp(self):
3534 self .dev_user = UserModel .objects .create_user ("dev_user" , "dev@user.com" , "123456" )
3635
3736 oauth2_settings .ALLOWED_REDIRECT_URI_SCHEMES = ['http' , 'custom-scheme' ]
38-
37+
3938 self .application = Application (
4039 name = "Test Application" ,
4140 redirect_uris = "http://localhost http://example.com http://example.it custom-scheme://example.com" ,
@@ -74,7 +73,6 @@ def test_skip_authorization_completely(self):
7473 response = self .client .get (url )
7574 self .assertEqual (response .status_code , 302 )
7675
77-
7876 def test_pre_auth_invalid_client (self ):
7977 """
8078 Test error for an invalid client_id with response_type: code
@@ -147,11 +145,11 @@ def test_pre_auth_valid_client_custom_redirect_uri_scheme(self):
147145
148146 def test_pre_auth_approval_prompt (self ):
149147 """
150-
148+ TODO
151149 """
152150 tok = AccessToken .objects .create (user = self .test_user , token = '1234567890' ,
153151 application = self .application ,
154- expires = timezone .now ()+ datetime .timedelta (days = 1 ),
152+ expires = timezone .now () + datetime .timedelta (days = 1 ),
155153 scope = 'read write' )
156154 self .client .login (username = "test_user" , password = "123456" )
157155 query_string = urlencode ({
@@ -173,13 +171,13 @@ def test_pre_auth_approval_prompt(self):
173171
174172 def test_pre_auth_approval_prompt_default (self ):
175173 """
176-
174+ TODO
177175 """
178176 self .assertEqual (oauth2_settings .REQUEST_APPROVAL_PROMPT , 'force' )
179177
180178 AccessToken .objects .create (user = self .test_user , token = '1234567890' ,
181179 application = self .application ,
182- expires = timezone .now ()+ datetime .timedelta (days = 1 ),
180+ expires = timezone .now () + datetime .timedelta (days = 1 ),
183181 scope = 'read write' )
184182 self .client .login (username = "test_user" , password = "123456" )
185183 query_string = urlencode ({
@@ -195,13 +193,13 @@ def test_pre_auth_approval_prompt_default(self):
195193
196194 def test_pre_auth_approval_prompt_default_override (self ):
197195 """
198-
196+ TODO
199197 """
200198 oauth2_settings .REQUEST_APPROVAL_PROMPT = 'auto'
201199
202200 AccessToken .objects .create (user = self .test_user , token = '1234567890' ,
203201 application = self .application ,
204- expires = timezone .now ()+ datetime .timedelta (days = 1 ),
202+ expires = timezone .now () + datetime .timedelta (days = 1 ),
205203 scope = 'read write' )
206204 self .client .login (username = "test_user" , password = "123456" )
207205 query_string = urlencode ({
@@ -634,7 +632,8 @@ def test_refresh_repeating_requests_non_rotating_tokens(self):
634632 'scope' : content ['scope' ],
635633 }
636634
637- with mock .patch ('oauthlib.oauth2.rfc6749.request_validator.RequestValidator.rotate_refresh_token' , return_value = False ):
635+ with mock .patch ('oauthlib.oauth2.rfc6749.request_validator.RequestValidator.rotate_refresh_token' ,
636+ return_value = False ):
638637 response = self .client .post (reverse ('oauth2_provider:token' ), data = token_request_data , ** auth_headers )
639638 self .assertEqual (response .status_code , 200 )
640639 response = self .client .post (reverse ('oauth2_provider:token' ), data = token_request_data , ** auth_headers )
@@ -742,7 +741,7 @@ def test_request_body_params(self):
742741 'code' : authorization_code ,
743742 'redirect_uri' : 'http://example.it' ,
744743 'client_id' : self .application .client_id ,
745- 'client_secret' : self .application .client_secret ,
744+ 'client_secret' : self .application .client_secret ,
746745 }
747746
748747 response = self .client .post (reverse ('oauth2_provider:token' ), data = token_request_data )
0 commit comments