File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,22 @@ def test_load_application_overwrites_client_on_client_id_mismatch(self):
241241 self .assertEqual (self .request .client , self .application )
242242 another_application .delete ()
243243
244+ @mock .patch .object (Application , "is_usable" )
245+ def test_load_application_returns_none_when_client_not_usable_cached (self , mock_is_usable ):
246+ mock_is_usable .return_value = False
247+ self .request .client = self .application
248+ application = self .validator ._load_application ("client_id" , self .request )
249+ self .assertIsNone (application )
250+ self .assertIsNone (self .request .client )
251+
252+ @mock .patch .object (Application , "is_usable" )
253+ def test_load_application_returns_none_when_client_not_usable_db_lookup (self , mock_is_usable ):
254+ mock_is_usable .return_value = False
255+ self .request .client = None
256+ application = self .validator ._load_application ("client_id" , self .request )
257+ self .assertIsNone (application )
258+ self .assertIsNone (self .request .client )
259+
244260 def test_rotate_refresh_token__is_true (self ):
245261 self .assertTrue (self .validator .rotate_refresh_token (mock .MagicMock ()))
246262
You can’t perform that action at this time.
0 commit comments