Skip to content

Commit 704885b

Browse files
committed
chore: complete test coverage
1 parent e5f78d5 commit 704885b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_oauth2_validators.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)