Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .uncover-agent/NOTE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# uncover-agent test diff
# original: https://github.com/geopython/pygeoapi/pull/2330
# generated 2026-10-21 09:29:36 UTC
40 changes: 40 additions & 0 deletions .uncover-agent/added.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
if v.get('visibility', 'default') == 'hidden' \
and dataset is None:
@pytest.fixture()
def config_exclusively_hidden_resources():
filename = 'pygeoapi-test-config-exclusively-hidden-resources.yml'
with open(get_test_file_path(filename)) as fh:
return yaml_load(fh)


@pytest.fixture()
def api_exclusively_hidden_resources(config_exclusively_hidden_resources, openapi): # noqa
'''Returns an API instance where all resources are marked as hidden'''
return API(config_exclusively_hidden_resources, openapi)


def test_describe_collections_with_only_hidden_resources(
api_exclusively_hidden_resources
):
'''
Test an API with only hidden resources to ensure
there are no indexing errors when no collections are returned
'''
req = mock_api_request({})
_, code, response = describe_collections(api_exclusively_hidden_resources, req) # noqa
assert code == HTTPStatus.OK

collections = json.loads(response)
assert len(collections['collections']) == 0, \
'All collections are hidden so there should be none in the response'

hidden_collection_name = 'objects'
_, code, response = describe_collections(
api_exclusively_hidden_resources, req, hidden_collection_name
)

assert code == HTTPStatus.OK
collection = json.loads(response)
assert collection['title'] == 'GeoJSON objects', \
'The collection should have its normal title even if hidden'

Loading