Skip to content

Commit 4e437c2

Browse files
committed
- added tests for test_get_collection_tiles_data
1 parent 14264b2 commit 4e437c2

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

pygeoapi/api/tiles.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def get_collection_tiles(api: API, request: APIRequest,
199199
return headers, HTTPStatus.OK, to_json(tiles, api.pretty_print)
200200

201201

202-
# TODO: no test for this function?
203202
def get_collection_tiles_data(
204203
api: API, request: APIRequest,
205204
dataset=None, matrix_id=None,

tests/api/test_tiles.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#
88
# Copyright (c) 2024 Tom Kralidis
99
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
10+
# Copyright (c) 2025 doublebyte
1011
#
1112
# Permission is hereby granted, free of charge, to any person
1213
# obtaining a copy of this software and associated documentation
@@ -39,7 +40,8 @@
3940
from pygeoapi.api import FORMAT_TYPES, F_HTML
4041
from pygeoapi.api.tiles import (
4142
get_collection_tiles, tilematrixset,
42-
tilematrixsets, get_collection_tiles_metadata
43+
tilematrixsets, get_collection_tiles_metadata,
44+
get_collection_tiles_data
4345
)
4446
from pygeoapi.models.provider.base import TileMatrixSetEnum
4547

@@ -65,6 +67,24 @@ def test_get_collection_tiles(config, api_):
6567
assert len(content['tilesets']) > 0
6668

6769

70+
def test_get_collection_tiles_data(config, api_):
71+
req = mock_api_request({'f': 'mvt'})
72+
rsp_headers, code, response = get_collection_tiles_data(
73+
api_, req, 'naturalearth/lakes',
74+
matrix_id='WebMercatorQuad', z_idx=0, x_idx=0, y_idx=0)
75+
assert code == HTTPStatus.OK
76+
77+
rsp_headers, code, response = get_collection_tiles_data(
78+
api_, req, 'naturalearth/lakes',
79+
matrix_id='WebMercatorQuad', z_idx=5, x_idx=15, y_idx=16)
80+
assert code == HTTPStatus.NO_CONTENT
81+
82+
rsp_headers, code, response = get_collection_tiles_data(
83+
api_, req, 'naturalearth/lakes',
84+
matrix_id='WebMercatorQuad', z_idx=0, x_idx=2, y_idx=2)
85+
assert code == HTTPStatus.NOT_FOUND
86+
87+
6888
def test_tilematrixsets(config, api_):
6989
req = mock_api_request()
7090
rsp_headers, code, response = tilematrixsets(api_, req)

0 commit comments

Comments
 (0)