@@ -674,3 +674,53 @@ async def test_queryables_enum_platform(
674674 # Clean up
675675 r = await app_client .delete (f"/collections/{ collection_id } " )
676676 r .raise_for_status ()
677+
678+
679+ @pytest .mark .asyncio
680+ async def test_queryables_excluded_fields (
681+ app_client : AsyncClient ,
682+ load_test_data : Callable [[str ], Dict ],
683+ monkeypatch : pytest .MonkeyPatch ,
684+ ):
685+ """Test that fields can be excluded from queryables using EXCLUDED_FROM_QUERYABLES."""
686+ # Arrange
687+ monkeypatch .setenv ("DATABASE_REFRESH" , "true" )
688+ monkeypatch .setenv (
689+ "EXCLUDED_FROM_QUERYABLES" , "properties.platform,properties.instrument"
690+ )
691+
692+ # Create collection
693+ collection_data = load_test_data ("test_collection.json" )
694+ collection_id = collection_data ["id" ] = f"exclude-test-collection-{ uuid .uuid4 ()} "
695+ r = await app_client .post ("/collections" , json = collection_data )
696+ r .raise_for_status ()
697+
698+ # Create an item
699+ item_data = load_test_data ("test_item.json" )
700+ item_data ["id" ] = "exclude-test-item"
701+ item_data ["collection" ] = collection_id
702+ item_data ["properties" ]["platform" ] = "landsat-8"
703+ item_data ["properties" ]["instrument" ] = "OLI_TIRS"
704+ r = await app_client .post (f"/collections/{ collection_id } /items" , json = item_data )
705+ r .raise_for_status ()
706+
707+ # Act
708+ queryables = (
709+ (await app_client .get (f"/collections/{ collection_id } /queryables" ))
710+ .raise_for_status ()
711+ .json ()
712+ )
713+
714+ # Assert
715+ # Excluded fields should NOT be in queryables
716+ properties = queryables ["properties" ]
717+ assert "platform" not in properties
718+ assert "instrument" not in properties
719+
720+ # Other fields should still be present
721+ assert "datetime" in properties
722+ assert "gsd" in properties
723+
724+ # Clean up
725+ r = await app_client .delete (f"/collections/{ collection_id } " )
726+ r .raise_for_status ()
0 commit comments