Skip to content

Commit 3b7419e

Browse files
committed
Add test for client registration with additional grant type
1 parent b3bc0aa commit 3b7419e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/server/fastmcp/auth/test_auth_integration.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,23 @@ async def test_client_registration_invalid_grant_type(self, test_client: httpx.A
942942
assert error_data["error"] == "invalid_client_metadata"
943943
assert error_data["error_description"] == "grant_types must be authorization_code and refresh_token"
944944

945+
@pytest.mark.anyio
946+
async def test_client_registration_with_additional_grant_type(self, test_client: httpx.AsyncClient):
947+
client_metadata = {
948+
"redirect_uris": ["https://client.example.com/callback"],
949+
"client_name": "Test Client",
950+
"grant_types": ["authorization_code", "refresh_token", "urn:ietf:params:oauth:grant-type:device_code"],
951+
}
952+
953+
response = await test_client.post("/register", json=client_metadata)
954+
assert response.status_code == 201
955+
client_info = response.json()
956+
957+
# Verify client was registered successfully
958+
assert "client_id" in client_info
959+
assert "client_secret" in client_info
960+
assert client_info["client_name"] == "Test Client"
961+
945962

946963
class TestAuthorizeEndpointErrors:
947964
"""Test error handling in the OAuth authorization endpoint."""

0 commit comments

Comments
 (0)