Skip to content

Commit

Permalink
Merge branch 'develop' into update_robots_txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariana-B authored Jul 8, 2024
2 parents c688069 + 5100d50 commit 0ce4551
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cubedash/_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,13 @@ def _handle_search_request(
"Only 'id', 'collection', and Item properties can be used to sort results.",
)

# Make sure users know that the query extension isn't implemented
if request_args.get("query") is not None:
abort(
400,
"The Query extension is no longer supported. Please use the Filter extension instead.",
)

filter_lang = request_args.get("filter-lang", default=None, type=str)
filter_cql = request_args.get("filter", default=None, type=_filter_arg)
filter_crs = request_args.get("filter-crs", default=None)
Expand Down
19 changes: 19 additions & 0 deletions integration_tests/test_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,3 +1544,22 @@ def test_stac_filter_extension(stac_client: FlaskClient):
headers={"Content-Type": "application/json", "Accept": "application/json"},
)
assert rv.status_code == 400


def test_stac_query_extension_errors(stac_client: FlaskClient):
# Trying to use query extension should error
query = {"cloud_cover": {"lt": 1}}
rv: Response = stac_client.post(
"/stac/search",
data=json.dumps(
{
"product": "ga_ls8c_ard_3",
"time": "2022-01-01T00:00:00/2022-12-31T00:00:00",
"limit": OUR_DATASET_LIMIT,
"_full": True,
"query": query,
}
),
headers={"Content-Type": "application/json", "Accept": "application/json"},
)
assert rv.status_code == 400

0 comments on commit 0ce4551

Please sign in to comment.