Skip to content

PgSTAC: Fields extension includes links even if not listed in includes #27

@lossyrob

Description

@lossyrob

This test currently fails:

@pytest.mark.asyncio
async def test_field_extension_includes_only_id_and_collection(
    app_client, load_test_data, load_test_collection
):
    """Test POST search including id and collection"""
    test_item = load_test_data("test_item.json")
    resp = await app_client.post(
        f"/collections/{test_item['collection']}/items", json=test_item
    )
    assert resp.status_code == 200

    body = {"fields": {"include": ["id", "collection"]}}

    resp = await app_client.post("/search", json=body)
    resp_json = resp.json()
    assert set(resp_json["features"][0].keys()) == {"id", "collection"}

with

E       AssertionError: assert {'links', 'id', 'collection'} == {'id', 'collection'}
E         Extra items in the left set:
E         'links'
E         Full diff:
E         - {'id', 'collection'}
E         + {'links', 'id', 'collection'}
E         ?  +++++++++

Links shouldn't be included in the response if they aren't in the "include" list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions