ayush786hack commented on code in PR #13676:
URL: https://github.com/apache/gravitino/pull/13676#discussion_r4237232558


##########
clients/client-python/tests/unittests/auth/test_oauth2_token_provider.py:
##########
@@ -114,3 +117,28 @@ def test_authentication_with_jwt(self, *mock_methods):
             token_provider.get_token_data().decode("utf-8"),
             AuthConstants.AUTHORIZATION_BEARER_HEADER + new_access_token,
         )
+     
+    @patch(
+        "gravitino.utils.http_client.HTTPClient.post_form",
+        return_value=mock_base.mock_authentication_with_basic_jwt(),
+    )
+    def test_client_secret_basic_authentication(self, mock_post_form):
+
+        token_provider = DefaultOAuth2TokenProvider(
+            uri=f"http://127.0.0.1:{OAUTH_PORT}";,
+            credential="clientId:clientSecret",
+            path="oauth/token",
+            scope="test",
+            authentication_method=(
+                OAuth2ClientAuthenticationMethod.CLIENT_SECRET_BASIC
+            ),
+        )
+
+        self.assertTrue(token_provider.has_token_data())
+
+        _, kwargs = mock_post_form.call_args
+
+        self.assertEqual(
+            kwargs["headers"]["Authorization"],
+            "Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0",

Review Comment:
   Fixed. The Python test now verifies that `client_id` and `client_secret` are 
absent from the form payload when using `CLIENT_SECRET_BASIC`. I've also added 
a negative test confirming that a missing client ID raises 
`IllegalArgumentException`. All 9 Python OAuth2 token-provider tests pass.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to