|
8 | 8 | import pytest |
9 | 9 | import pytest_asyncio |
10 | 10 | from fastapi import Depends, HTTPException, security, status |
11 | | -from httpx import AsyncClient |
| 11 | +from httpx import ASGITransport, AsyncClient |
| 12 | +from pydantic import ConfigDict |
12 | 13 | from stac_pydantic import api |
13 | 14 |
|
14 | 15 | from stac_fastapi.api.app import StacApi |
@@ -85,8 +86,7 @@ def __init__( |
85 | 86 |
|
86 | 87 |
|
87 | 88 | class TestSettings(AsyncSettings): |
88 | | - class Config: |
89 | | - env_file = ".env.test" |
| 89 | + model_config = ConfigDict(env_file=".env.test") |
90 | 90 |
|
91 | 91 |
|
92 | 92 | settings = TestSettings() |
@@ -243,7 +243,9 @@ async def app_client(app): |
243 | 243 | await create_index_templates() |
244 | 244 | await create_collection_index() |
245 | 245 |
|
246 | | - async with AsyncClient(app=app, base_url="http://test-server") as c: |
| 246 | + async with AsyncClient( |
| 247 | + transport=ASGITransport(app=app), base_url="http://test-server" |
| 248 | + ) as c: |
247 | 249 | yield c |
248 | 250 |
|
249 | 251 |
|
@@ -302,7 +304,9 @@ async def app_client_rate_limit(app_rate_limit): |
302 | 304 | await create_index_templates() |
303 | 305 | await create_collection_index() |
304 | 306 |
|
305 | | - async with AsyncClient(app=app_rate_limit, base_url="http://test-server") as c: |
| 307 | + async with AsyncClient( |
| 308 | + transport=ASGITransport(app=app_rate_limit), base_url="http://test-server" |
| 309 | + ) as c: |
306 | 310 | yield c |
307 | 311 |
|
308 | 312 |
|
@@ -392,7 +396,9 @@ async def app_client_basic_auth(app_basic_auth): |
392 | 396 | await create_index_templates() |
393 | 397 | await create_collection_index() |
394 | 398 |
|
395 | | - async with AsyncClient(app=app_basic_auth, base_url="http://test-server") as c: |
| 399 | + async with AsyncClient( |
| 400 | + transport=ASGITransport(app=app_basic_auth), base_url="http://test-server" |
| 401 | + ) as c: |
396 | 402 | yield c |
397 | 403 |
|
398 | 404 |
|
@@ -469,6 +475,7 @@ async def route_dependencies_client(route_dependencies_app): |
469 | 475 | await create_collection_index() |
470 | 476 |
|
471 | 477 | async with AsyncClient( |
472 | | - app=route_dependencies_app, base_url="http://test-server" |
| 478 | + transport=ASGITransport(app=route_dependencies_app), |
| 479 | + base_url="http://test-server", |
473 | 480 | ) as c: |
474 | 481 | yield c |
0 commit comments