44import pytest
55from stac_pydantic import Collection
66
7- from ..conftest import requires_pgstac_0_9_2
8-
97
108async def test_create_collection (app_client , load_test_data : Callable ):
119 in_json = load_test_data ("test_collection.json" )
@@ -349,11 +347,15 @@ async def test_get_collections_search(
349347 assert len (resp .json ()["collections" ]) == 2
350348
351349
352- @requires_pgstac_0_9_2
353350@pytest .mark .asyncio
354351async def test_collection_search_freetext (
355352 app_client , load_test_collection , load_test2_collection
356353):
354+ res = await app_client .get ("/_mgmt/health" )
355+ pgstac_version = res .json ()["pgstac" ]["pgstac_version" ]
356+ if tuple (map (int , pgstac_version .split ("." ))) < (0 , 9 , 2 ):
357+ pass
358+
357359 # free-text
358360 resp = await app_client .get (
359361 "/collections" ,
@@ -388,11 +390,15 @@ async def test_collection_search_freetext(
388390 assert len (resp .json ()["collections" ]) == 0
389391
390392
391- @requires_pgstac_0_9_2
392393@pytest .mark .asyncio
393394async def test_collection_search_freetext_advanced (
394395 app_client_advanced_freetext , load_test_collection , load_test2_collection
395396):
397+ res = await app_client_advanced_freetext .get ("/_mgmt/health" )
398+ pgstac_version = res .json ()["pgstac" ]["pgstac_version" ]
399+ if tuple (map (int , pgstac_version .split ("." ))) < (0 , 9 , 2 ):
400+ pass
401+
396402 # free-text
397403 resp = await app_client_advanced_freetext .get (
398404 "/collections" ,
@@ -436,9 +442,13 @@ async def test_collection_search_freetext_advanced(
436442 assert len (resp .json ()["collections" ]) == 0
437443
438444
439- @requires_pgstac_0_9_2
440445@pytest .mark .asyncio
441446async def test_all_collections_with_pagination (app_client , load_test_data ):
447+ res = await app_client .get ("/_mgmt/health" )
448+ pgstac_version = res .json ()["pgstac" ]["pgstac_version" ]
449+ if tuple (map (int , pgstac_version .split ("." ))) < (0 , 9 , 2 ):
450+ pass
451+
442452 data = load_test_data ("test_collection.json" )
443453 collection_id = data ["id" ]
444454 for ii in range (0 , 12 ):
@@ -468,9 +478,13 @@ async def test_all_collections_with_pagination(app_client, load_test_data):
468478 assert {"root" , "self" } == {link ["rel" ] for link in links }
469479
470480
471- @requires_pgstac_0_9_2
472481@pytest .mark .asyncio
473482async def test_all_collections_without_pagination (app_client_no_ext , load_test_data ):
483+ res = await app_client_no_ext .get ("/_mgmt/health" )
484+ pgstac_version = res .json ()["pgstac" ]["pgstac_version" ]
485+ if tuple (map (int , pgstac_version .split ("." ))) < (0 , 9 , 2 ):
486+ pass
487+
474488 data = load_test_data ("test_collection.json" )
475489 collection_id = data ["id" ]
476490 for ii in range (0 , 12 ):
@@ -491,11 +505,15 @@ async def test_all_collections_without_pagination(app_client_no_ext, load_test_d
491505 assert {"root" , "self" } == {link ["rel" ] for link in links }
492506
493507
494- @requires_pgstac_0_9_2
495508@pytest .mark .asyncio
496509async def test_get_collections_search_pagination (
497510 app_client , load_test_collection , load_test2_collection
498511):
512+ res = await app_client .get ("/_mgmt/health" )
513+ pgstac_version = res .json ()["pgstac" ]["pgstac_version" ]
514+ if tuple (map (int , pgstac_version .split ("." ))) < (0 , 9 , 2 ):
515+ pass
516+
499517 resp = await app_client .get ("/collections" )
500518 assert resp .json ()["numberReturned" ] == 2
501519 assert resp .json ()["numberMatched" ] == 2
@@ -621,12 +639,16 @@ async def test_get_collections_search_pagination(
621639 assert {"root" , "self" } == {link ["rel" ] for link in links }
622640
623641
624- @requires_pgstac_0_9_2
625642@pytest .mark .xfail (strict = False )
626643@pytest .mark .asyncio
627644async def test_get_collections_search_offset_1 (
628645 app_client , load_test_collection , load_test2_collection
629646):
647+ res = await app_client .get ("/_mgmt/health" )
648+ pgstac_version = res .json ()["pgstac" ]["pgstac_version" ]
649+ if tuple (map (int , pgstac_version .split ("." ))) < (0 , 9 , 2 ):
650+ pass
651+
630652 # BUG: pgstac doesn't return a `prev` link when limit is not set
631653 # offset=1, should have a `previous` link
632654 resp = await app_client .get (
0 commit comments