7
7
8
8
import pytest
9
9
from httpx import AsyncClient
10
- from stac_pydantic import api
11
-
12
- from stac_fastapi .core .core import TransactionsClient
13
-
14
- from ..conftest import MockRequest
15
10
16
11
THIS_DIR = os .path .dirname (os .path .abspath (__file__ ))
17
12
@@ -636,16 +631,14 @@ async def test_search_filter_extension_cql2text_s_disjoint_property(app_client,
636
631
@pytest .mark .asyncio
637
632
async def test_queryables_enum_platform (
638
633
app_client : AsyncClient ,
639
- txn_client : TransactionsClient ,
640
634
load_test_data : Callable [[str ], Dict ],
641
635
):
642
636
# Arrange
643
637
# Create collection
644
638
collection_data = load_test_data ("test_collection.json" )
645
639
collection_id = collection_data ["id" ] = "enum-test-collection"
646
- await txn_client .create_collection (
647
- api .Collection (** collection_data ), request = MockRequest
648
- )
640
+ r = await app_client .post ("/collections" , json = collection_data )
641
+ r .raise_for_status ()
649
642
650
643
# Create items with different platform values
651
644
NUM_ITEMS = 3
@@ -654,12 +647,8 @@ async def test_queryables_enum_platform(
654
647
item_data ["id" ] = f"enum-test-item-{ i } "
655
648
item_data ["collection" ] = collection_id
656
649
item_data ["properties" ]["platform" ] = "landsat-8" if i % 2 else "sentinel-2"
657
- await txn_client .create_item (
658
- collection_id = collection_id ,
659
- item = api .Item (** item_data ),
660
- request = MockRequest ,
661
- refresh = i == NUM_ITEMS ,
662
- )
650
+ r = await app_client .post (f"/collections/{ collection_id } /items" , json = item_data )
651
+ r .raise_for_status ()
663
652
664
653
# Act
665
654
# Test queryables endpoint
@@ -677,4 +666,5 @@ async def test_queryables_enum_platform(
677
666
assert set (platform_values ) == {"landsat-8" , "sentinel-2" }
678
667
679
668
# Clean up
680
- await txn_client .delete_collection (collection_id )
669
+ r = await app_client .delete (f"/collections/{ collection_id } " )
670
+ r .raise_for_status ()
0 commit comments