Skip to content

Commit

Permalink
fix test to be compatible with both elasticsearch and opensearch
Browse files Browse the repository at this point in the history
  • Loading branch information
StijnCaerts committed Mar 12, 2024
1 parent b3804b5 commit 3f70857
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions stac_fastapi/tests/database/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
@pytest.mark.asyncio
async def test_index_mapping_collections(ctx):
response = await database.client.indices.get_mapping(index=COLLECTIONS_INDEX)
actual_mappings = next(iter(response.body.values()))["mappings"]
if not isinstance(response, dict):
response = response.body
actual_mappings = next(iter(response.values()))["mappings"]
assert (
actual_mappings["dynamic_templates"]
== ES_COLLECTIONS_MAPPINGS["dynamic_templates"]
Expand All @@ -40,7 +42,9 @@ async def test_index_mapping_items(ctx, txn_client):
response = await database.client.indices.get_mapping(
index=index_by_collection_id(collection["id"])
)
actual_mappings = next(iter(response.body.values()))["mappings"]
if not isinstance(response, dict):
response = response.body
actual_mappings = next(iter(response.values()))["mappings"]
assert (
actual_mappings["dynamic_templates"] == ES_ITEMS_MAPPINGS["dynamic_templates"]
)
Expand Down

0 comments on commit 3f70857

Please sign in to comment.