@@ -274,22 +274,22 @@ async def mock_acreate(*args, **kwargs):
274
274
275
275
276
276
@pytest .fixture (scope = "function" )
277
- def mock_default_azure_credential (mock_session_env ):
277
+ def mock_azure_credential (mock_session_env ):
278
278
"""Mock the Azure credential for testing."""
279
- with mock .patch ("azure.identity.DefaultAzureCredential " ) as mock_default_azure_credential :
280
- mock_default_azure_credential .return_value = MockAzureCredential ()
281
- yield mock_default_azure_credential
279
+ with mock .patch ("azure.identity.AzureDeveloperCliCredential " ) as mock_azure_credential :
280
+ mock_azure_credential .return_value = MockAzureCredential ()
281
+ yield mock_azure_credential
282
282
283
283
284
284
@pytest_asyncio .fixture (scope = "function" )
285
- async def test_client (app , mock_default_azure_credential , mock_openai_embedding , mock_openai_chatcompletion ):
285
+ async def test_client (app , mock_azure_credential , mock_openai_embedding , mock_openai_chatcompletion ):
286
286
"""Create a test client."""
287
287
with TestClient (app ) as test_client :
288
288
yield test_client
289
289
290
290
291
291
@pytest_asyncio .fixture (scope = "function" )
292
- async def db_session (mock_session_env , mock_default_azure_credential ):
292
+ async def db_session (mock_session_env , mock_azure_credential ):
293
293
"""Create a new database session with a rollback at the end of the test."""
294
294
engine = await create_postgres_engine_from_env ()
295
295
async_sesion = async_sessionmaker (autocommit = False , autoflush = False , bind = engine )
@@ -302,10 +302,10 @@ async def db_session(mock_session_env, mock_default_azure_credential):
302
302
303
303
304
304
@pytest_asyncio .fixture (scope = "function" )
305
- async def postgres_searcher (mock_session_env , mock_default_azure_credential , db_session , mock_openai_embedding ):
305
+ async def postgres_searcher (mock_session_env , mock_azure_credential , db_session , mock_openai_embedding ):
306
306
from fastapi_app .postgres_searcher import PostgresSearcher
307
307
308
- openai_embed_client = await create_openai_embed_client (mock_default_azure_credential )
308
+ openai_embed_client = await create_openai_embed_client (mock_azure_credential )
309
309
310
310
yield PostgresSearcher (
311
311
db_session = db_session ,
0 commit comments