Skip to content

Commit 8653550

Browse files
committed
Add missing test case in the validor class
This commit adds a missing test that covers the newly introduced use case where the client application is Public and the grant type is device code. Here, there is no need for a HTTP auth therefore always expected a True return value.
1 parent 74ffed5 commit 8653550

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/test_oauth2_validators.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ def test_authenticate_basic_auth_not_utf8(self):
180180
self.request.headers = {"HTTP_AUTHORIZATION": "Basic test"}
181181
self.assertFalse(self.validator._authenticate_basic_auth(self.request))
182182

183+
def test_authenticate_basic_auth_public_app_with_device_code(self):
184+
self.request.grant_type = "urn:ietf:params:oauth:grant-type:device_code"
185+
self.request.headers = get_basic_auth_header("client_id", CLEARTEXT_SECRET)
186+
self.application.client_type = Application.CLIENT_PUBLIC
187+
self.assertTrue(self.validator._authenticate_basic_auth(self.request))
188+
183189
def test_authenticate_check_secret(self):
184190
hashed = make_password(CLEARTEXT_SECRET)
185191
self.assertTrue(self.validator._check_secret(CLEARTEXT_SECRET, CLEARTEXT_SECRET))

0 commit comments

Comments
 (0)