Skip to content

Commit bda0369

Browse files
fix: update mock_query_items to accept additional kwargs for improved flexibility
1 parent 6bdd50e commit bda0369

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/tests/backend/common/database/cosmosdb_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ async def test_get_batch(cosmos_db_client, mocker):
407407
}
408408

409409
# We define the async generator function that will yield the expected batch
410-
async def mock_query_items(query, parameters):
410+
async def mock_query_items(query, parameters, **kwargs):
411411
yield expected_batch
412412

413413
# Assign the async generator to query_items mock
@@ -425,6 +425,7 @@ async def mock_query_items(query, parameters):
425425
{"name": "@batch_id", "value": batch_id},
426426
{"name": "@user_id", "value": user_id},
427427
],
428+
partition_key=batch_id,
428429
)
429430

430431

@@ -471,8 +472,8 @@ async def test_get_file(cosmos_db_client, mocker):
471472
"blob_path": "/path/to/file"
472473
}
473474

474-
# We define the async generator function that will yield the expected batch
475-
async def mock_query_items(query, parameters):
475+
# We define the async generator function that will yield the expected file
476+
async def mock_query_items(query, parameters, **kwargs):
476477
yield expected_file
477478

478479
# Assign the async generator to query_items mock
@@ -597,7 +598,7 @@ async def test_get_batch_from_id(cosmos_db_client, mocker):
597598
}
598599

599600
# Define the async generator function that will yield the expected batch
600-
async def mock_query_items(query, parameters):
601+
async def mock_query_items(query, parameters, **kwargs):
601602
yield expected_batch
602603

603604
# Assign the async generator to query_items mock

0 commit comments

Comments
 (0)