mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-30 03:02:08 +02:00
* Fix type errors for ty 0.0.1-alpha.31 upgrade Add type ignores and fixes for ty's stricter checking: - Path(None) guards in cli.py - isinstance checks for ElicitRequestFormParams (URL elicitation support) - TODO(ty) comments for match/isinstance narrowing bugs - Method override type ignores for generic covariance - Starlette Middleware typing workarounds - Dynamic type construction ignores in json_schema_type.py * Fix remaining type errors for ty 0.0.1-alpha.31 - Add asserts for optional attribute access in tests - Add type ignores for dynamic httpx transport internals - Add TODO(ty) comments for `in` operator on str|bytes - Add TODO(ty) comments for Starlette Middleware typing - Use cast for prompt.fn async validation in server.py * Upgrade ty to 0.0.1-alpha.31 Fixes additional test file type errors discovered after upgrade.
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from ssl import VerifyMode
|
|
|
|
import httpx
|
|
|
|
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",
|
|
)
|
|
|
|
async with transport.auth.httpx_client_factory() as httpx_client: # type: ignore[attr-defined]
|
|
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",
|
|
)
|
|
|
|
async with transport.auth.httpx_client_factory() as httpx_client: # type: ignore[attr-defined]
|
|
assert httpx_client._transport is not None
|
|
assert (
|
|
httpx_client._transport._pool._ssl_context.verify_mode # type: ignore[attr-defined]
|
|
== VerifyMode.CERT_NONE
|
|
)
|