test for item prev and next links on item queries (#752) (#757)

This commit is contained in:
Tom Kralidis
2021-08-25 06:34:39 -04:00
committed by GitHub
parent 719201241a
commit 6dcd10b10a
2 changed files with 20 additions and 10 deletions
+18 -10
View File
@@ -1832,16 +1832,24 @@ class API:
request.locale),
'href': '{}/collections/{}'.format(
self.config['server']['url'], dataset)
}, {
'rel': 'prev',
'type': 'application/geo+json',
'href': uri
}, {
'rel': 'next',
'type': 'application/geo+json',
'href': uri
}
]
}]
if 'prev' in content:
content['links'].append({
'rel': 'prev',
'type': FORMAT_TYPES[request.format],
'href': '{}/collections/{}/items/{}?f={}'.format(
self.config['server']['url'], dataset,
content['prev'], request.format)
})
if 'next' in content:
content['links'].append({
'rel': 'next',
'type': FORMAT_TYPES[request.format],
'href': '{}/collections/{}/items/{}?f={}'.format(
self.config['server']['url'], dataset,
content['next'], request.format)
})
# Set response language to requested provider locale
# (if it supports language) and/or otherwise the requested pygeoapi
+2
View File
@@ -724,6 +724,8 @@ def test_get_collection_item(config, api_):
feature = json.loads(response)
assert feature['properties']['stn_id'] == '35'
assert 'prev' not in feature['links']
assert 'next' not in feature['links']
def test_get_collection_item_json_ld(config, api_):