mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 06:24:18 +02:00
* Replace type: ignore[attr-defined] with isinstance assertions in tests * Fix isinstance assertions in failing tests - Fix enum test to check for ResponseEnum instead of str - Fix binary resource test to check for BlobResourceContents instead of TextResourceContents - Fix Root type tests to check attributes directly instead of isinstance checks * Fix type errors without using type: ignore - Remove execution methods from TransformingProvider (only handles transformations) - Add execution methods to base Provider class with default implementations - Fix type narrowing in tests using cast() instead of type: ignore - Fix PromptResult type handling in prompt render tests - Fix type narrowing in middleware test for arguments and structured_content
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
from ssl import VerifyMode
|
|
|
|
import httpx
|
|
|
|
from fastmcp.client.auth.oauth import OAuth
|
|
from fastmcp.client.transports import SSETransport, StreamableHttpTransport
|
|
|
|
|
|
async def test_oauth_uses_same_client_as_transport_streamable_http():
|
|
transport = StreamableHttpTransport(
|
|
"https://some.fake.url/",
|
|
httpx_client_factory=lambda *args, **kwargs: httpx.AsyncClient(
|
|
verify=False, *args, **kwargs
|
|
),
|
|
auth="oauth",
|
|
)
|
|
|
|
assert isinstance(transport.auth, OAuth)
|
|
async with transport.auth.httpx_client_factory() as httpx_client:
|
|
assert httpx_client._transport is not None
|
|
assert (
|
|
httpx_client._transport._pool._ssl_context.verify_mode # type: ignore[attr-defined]
|
|
== VerifyMode.CERT_NONE
|
|
)
|
|
|
|
|
|
async def test_oauth_uses_same_client_as_transport_sse():
|
|
transport = SSETransport(
|
|
"https://some.fake.url/",
|
|
httpx_client_factory=lambda *args, **kwargs: httpx.AsyncClient(
|
|
verify=False, *args, **kwargs
|
|
),
|
|
auth="oauth",
|
|
)
|
|
|
|
assert isinstance(transport.auth, OAuth)
|
|
async with transport.auth.httpx_client_factory() as httpx_client:
|
|
assert httpx_client._transport is not None
|
|
assert (
|
|
httpx_client._transport._pool._ssl_context.verify_mode # type: ignore[attr-defined]
|
|
== VerifyMode.CERT_NONE
|
|
)
|