2024-12-30 01:59:08 -05:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
"""
|
|
|
|
Integration tests for the /index API endpoints.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from azure.cosmos import CosmosClient
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_list_of_index_containers_empty(client, cosmos_client: CosmosClient):
|
|
|
|
"""Test getting a list of all blob containers holding an index."""
|
|
|
|
response = client.get("/index")
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
|
|
|
def test_schedule_index_without_data(client, cosmos_client: CosmosClient):
|
|
|
|
"""Test scheduling an index job with a non-existent data blob container."""
|
|
|
|
response = client.post(
|
|
|
|
"/index",
|
2025-01-30 13:59:51 -05:00
|
|
|
params={
|
|
|
|
"index_container_name": "myindex",
|
|
|
|
"storage_container_name": "nonexistent-data-container",
|
|
|
|
},
|
2024-12-30 01:59:08 -05:00
|
|
|
)
|
2025-04-08 11:00:28 -04:00
|
|
|
assert response.status_code == 412
|
2024-12-30 01:59:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
# def test_schedule_index_with_data(client, cosmos_client, blob_with_data_container_name):
|
|
|
|
# """Test scheduling an index job with real data."""
|
2025-01-30 13:59:51 -05:00
|
|
|
# response = client.post("/index", files=None, params={"storage_container_name": blob_with_data_container_name, "index_container_name": "myindex"})
|
2024-12-30 01:59:08 -05:00
|
|
|
# print(response.json())
|
|
|
|
# assert response.status_code == 200
|