77import pytest
88from fastapi import Request
99from httpx import ASGITransport , AsyncClient
10- from pypgstac .db import PgstacDB
11- from pypgstac .load import Loader
1210from pystac import Collection , Extent , Item , SpatialExtent , TemporalExtent
1311from stac_fastapi .api .app import StacApi
1412from stac_fastapi .api .models import create_get_request_model , create_post_request_model
@@ -801,12 +799,6 @@ async def test_no_extension(
801799 hydrate , validation , load_test_data , database , pgstac
802800) -> None :
803801 """test PgSTAC with no extension."""
804- connection = f"postgresql://{ database .user } :{ quote_plus (database .password )} @{ database .host } :{ database .port } /{ database .dbname } "
805- with PgstacDB (dsn = connection ) as db :
806- loader = Loader (db = db )
807- loader .load_collections (os .path .join (DATA_DIR , "test_collection.json" ))
808- loader .load_items (os .path .join (DATA_DIR , "test_item.json" ))
809-
810802 settings = Settings (
811803 testing = True ,
812804 use_api_hydrate = hydrate ,
@@ -819,7 +811,9 @@ async def test_no_extension(
819811 pgport = database .port ,
820812 pgdatabase = database .dbname ,
821813 )
822- extensions = []
814+ extensions = [
815+ TransactionExtension (client = TransactionsClient (), settings = settings ),
816+ ]
823817 post_request_model = create_post_request_model (extensions , base_model = PgstacSearch )
824818 api = StacApi (
825819 client = CoreCrudClient (pgstac_search_model = post_request_model ),
@@ -835,6 +829,16 @@ async def test_no_extension(
835829 )
836830 try :
837831 async with AsyncClient (transport = ASGITransport (app = app )) as client :
832+ resp = await client .post (
833+ "/collections" , json = load_test_data ("test_collection.json" )
834+ )
835+ collection_id = resp .json ()["id" ]
836+ _ = await client .post ("/collections" , json = load_test_data ("test_item.json" ))
837+ resp = await client .post (
838+ f"/collections/{ collection_id } /items" ,
839+ json = load_test_data ("test_item.json" ),
840+ )
841+
838842 landing = await client .get ("http://test/" )
839843 assert landing .status_code == 200 , landing .text
840844 assert "Queryables" not in [
0 commit comments