|
34 | 34 |
|
35 | 35 | import json |
36 | 36 | from http import HTTPStatus |
| 37 | +import pytest |
37 | 38 |
|
38 | 39 | from pygeoapi.api import FORMAT_TYPES, F_HTML |
39 | 40 | from pygeoapi.api.tiles import ( |
40 | | - get_collection_tiles, tilematrixset, tilematrixsets, |
| 41 | + get_collection_tiles, tilematrixset, |
| 42 | + tilematrixsets, get_collection_tiles_metadata |
41 | 43 | ) |
42 | 44 | from pygeoapi.models.provider.base import TileMatrixSetEnum |
43 | 45 |
|
@@ -83,6 +85,23 @@ def test_tilematrixsets(config, api_): |
83 | 85 | assert rsp_headers['Content-Language'] == 'en-US' |
84 | 86 |
|
85 | 87 |
|
| 88 | +@pytest.mark.parametrize('file_format', ['html', 'json', 'tilejson']) |
| 89 | +def test_get_collection_tiles_metadata_bad_request(api_, file_format): |
| 90 | + req = mock_api_request({'f': file_format}) |
| 91 | + _, code, _ = get_collection_tiles_metadata( |
| 92 | + api_, req, 'obs', 'WorldCRS84Quad') |
| 93 | + assert code == HTTPStatus.BAD_REQUEST |
| 94 | + |
| 95 | + |
| 96 | +@pytest.mark.parametrize('file_format', ['json', 'tilejson']) |
| 97 | +def test_get_collection_tiles_metadata_formats(api_, file_format): |
| 98 | + req = mock_api_request({'f': file_format}) |
| 99 | + _, code, response = get_collection_tiles_metadata( |
| 100 | + api_, req, 'naturalearth/lakes', matrix_id='WebMercatorQuad') |
| 101 | + assert code == HTTPStatus.OK |
| 102 | + assert json.loads(response) |
| 103 | + |
| 104 | + |
86 | 105 | def test_tilematrixset(config, api_): |
87 | 106 | req = mock_api_request() |
88 | 107 |
|
|
0 commit comments