@@ -850,6 +850,12 @@ async def test_item_search_post_filter_extension_cql2(
850
850
)
851
851
assert resp .status_code == 201
852
852
853
+ # make sure we have 2 items
854
+ resp = await app_client .post ("/search" , json = {})
855
+ resp_json = resp .json ()
856
+ assert resp .status_code == 200
857
+ assert len (resp_json .get ("features" )) == 2
858
+
853
859
# EPSG is a JSONB key
854
860
params = {
855
861
"collections" : [test_item ["collection" ]],
@@ -887,6 +893,39 @@ async def test_item_search_post_filter_extension_cql2(
887
893
== test_item ["properties" ]["proj:epsg" ]
888
894
)
889
895
896
+ # Test IN operator
897
+ params = {
898
+ "collections" : [test_item ["collection" ]],
899
+ "filter-lang" : "cql2-json" ,
900
+ "filter" : {
901
+ "op" : "in" ,
902
+ "args" : [
903
+ {"property" : "proj:epsg" },
904
+ [test_item ["properties" ]["proj:epsg" ]],
905
+ ],
906
+ },
907
+ }
908
+ resp = await app_client .post ("/search" , json = params )
909
+ resp_json = resp .json ()
910
+ assert resp .status_code == 200
911
+ assert len (resp_json .get ("features" )) == 1
912
+
913
+ params = {
914
+ "collections" : [test_item ["collection" ]],
915
+ "filter-lang" : "cql2-json" ,
916
+ "filter" : {
917
+ "op" : "in" ,
918
+ "args" : [
919
+ {"property" : "proj:epsg" },
920
+ [test_item ["properties" ]["proj:epsg" ] + 1 ],
921
+ ],
922
+ },
923
+ }
924
+ resp = await app_client .post ("/search" , json = params )
925
+ resp_json = resp .json ()
926
+ assert resp .status_code == 200
927
+ assert len (resp_json .get ("features" )) == 0
928
+
890
929
891
930
async def test_item_search_post_filter_extension_cql2_with_query_fails (
892
931
app_client , load_test_data , load_test_collection
@@ -904,7 +943,7 @@ async def test_item_search_post_filter_extension_cql2_with_query_fails(
904
943
)
905
944
assert resp .status_code == 201
906
945
907
- # EPSG is a JSONB key
946
+ # Cannot use `query` and `filter`
908
947
params = {
909
948
"collections" : [test_item ["collection" ]],
910
949
"filter-lang" : "cql2-json" ,
0 commit comments