Skip to content

Commit f78d563

Browse files
committed
Merge branch 'moarOutputType' of github.com:developmentseed/tifeatures into moarOutputType
2 parents 664b7e3 + 574c9e7 commit f78d563

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

tests/routes/test_item.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ def test_item(app):
1616
assert "text/html" in response.headers["content-type"]
1717
assert "Collection Item: 1" in response.text
1818

19+
# json output
20+
response = app.get("/collections/public.landsat_wrs/items/1?f=json")
21+
assert response.status_code == 200
22+
assert response.headers["content-type"] == "application/json"
23+
feat = response.json()
24+
assert ["colectionId", "itemId", "id", "pr", "row", "path", "ogc_fid"] == list(
25+
feat.keys()
26+
)
27+
1928
# not found
2029
response = app.get("/collections/public.landsat_wrs/items/50000")
2130
assert response.status_code == 404

tests/routes/test_items.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,3 +535,23 @@ def test_output_response_type(app):
535535
body = response.text.splitlines()
536536
assert len(body) == 10
537537
assert json.loads(body[0])["type"] == "Feature"
538+
539+
# json output
540+
response = app.get("/collections/public.landsat_wrs/items?f=json")
541+
assert response.status_code == 200
542+
assert response.headers["content-type"] == "application/json"
543+
body = response.json()
544+
assert len(body) == 10
545+
feat = body[0]
546+
assert ["colectionId", "itemId", "id", "pr", "row", "path", "ogc_fid"] == list(
547+
feat.keys()
548+
)
549+
550+
response = app.get(
551+
"/collections/public.landsat_wrs/items",
552+
headers={"accept": "application/json"},
553+
)
554+
assert response.status_code == 200
555+
assert response.headers["content-type"] == "application/json"
556+
body = response.json()
557+
assert len(body) == 10

0 commit comments

Comments
 (0)