Skip to content

Commit

Permalink
BUGFIX: invalid landing page link when filter-extension is enabled (#…
Browse files Browse the repository at this point in the history
…695)

* add test demonstrating bug

* fix
  • Loading branch information
vincentsarago authored May 22, 2024
1 parent d2fd4a6 commit a6a5765
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions stac_fastapi/api/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def test_client_openapi(TestCoreClient):
assert component in test_app.app.openapi_schema["components"]["schemas"]


def test_filter_extension(TestCoreClient, item_dict):
@pytest.mark.parametrize("validate", [True, False])
def test_filter_extension(validate, TestCoreClient, item_dict):
"""Test if Filter Parameters are passed correctly."""

class FilterClient(TestCoreClient):
Expand Down Expand Up @@ -159,13 +160,15 @@ def get_search(
post_request_model = create_post_request_model([FilterExtension()])

test_app = app.StacApi(
settings=ApiSettings(),
settings=ApiSettings(enable_response_models=validate),
client=FilterClient(post_request_model=post_request_model),
search_get_request_model=create_get_request_model([FilterExtension()]),
search_post_request_model=post_request_model,
extensions=[FilterExtension()],
)

with TestClient(test_app.app) as client:
landing = client.get("/")
get_search = client.get(
"/search",
params={
Expand All @@ -184,5 +187,6 @@ def get_search(
},
)

assert landing.status_code == 200, landing.text
assert get_search.status_code == 200, get_search.text
assert post_search.status_code == 200, post_search.text
1 change: 0 additions & 1 deletion stac_fastapi/types/stac_fastapi/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ def landing_page(self, **kwargs) -> stac.LandingPage:
"type": MimeTypes.jsonschema.value,
"title": "Queryables",
"href": urljoin(base_url, "queryables"),
"method": "GET",
}
)

Expand Down

0 comments on commit a6a5765

Please sign in to comment.