Skip to content

Commit 021d57c

Browse files
Merge pull request #24 from developmentseed/feature/tests-wmts
add tests for wmts endpoints
2 parents dd935d7 + ab644fa commit 021d57c

File tree

7 files changed

+826
-6
lines changed

7 files changed

+826
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ test = [
4141
"pytest-cov",
4242
"pytest-asyncio",
4343
"httpx",
44+
"owslib",
4445
]
4546

4647
[project.urls]

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
def app(monkeypatch):
1414
"""App fixture."""
1515
monkeypatch.setenv("TITILER_STACAPI_STAC_API_URL", "http://something.stac")
16+
monkeypatch.setenv("TITILER_STACAPI_API_DEBUG", "TRUE")
17+
monkeypatch.setenv("TITILER_STACAPI_CACHE_DISABLE", "TRUE")
1618

1719
from titiler.stacapi.main import app
1820

489 KB
Binary file not shown.
Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
{
2+
"id": "46_033111301201_1040010082988200",
3+
"bbox": [
4+
91.88812130564935,
5+
21.518532895453674,
6+
91.93942487240946,
7+
21.520759340266974
8+
],
9+
"type": "Feature",
10+
"links": [
11+
{
12+
"rel": "collection",
13+
"type": "application/json",
14+
"href": "https://stac.eoapi.dev/collections/MAXAR_BayofBengal_Cyclone_Mocha_May_23"
15+
},
16+
{
17+
"rel": "parent",
18+
"type": "application/json",
19+
"href": "https://stac.eoapi.dev/collections/MAXAR_BayofBengal_Cyclone_Mocha_May_23"
20+
},
21+
{
22+
"rel": "root",
23+
"type": "application/json",
24+
"href": "https://stac.eoapi.dev/"
25+
},
26+
{
27+
"rel": "self",
28+
"type": "application/geo+json",
29+
"href": "https://stac.eoapi.dev/collections/MAXAR_BayofBengal_Cyclone_Mocha_May_23/items/46_033111301201_1040010082988200"
30+
}
31+
],
32+
"assets": {
33+
"visual": {
34+
"href": "s3://maxar-opendata/events/BayofBengal-Cyclone-Mocha-May-23/ard/46/033111301201/2023-03-14/1040010082988200-visual.tif",
35+
"type": "image/tiff; application=geotiff; profile=cloud-optimized",
36+
"roles": [
37+
"visual"
38+
],
39+
"title": "Visual Image",
40+
"eo:bands": [
41+
{
42+
"name": "BAND_R",
43+
"common_name": "red",
44+
"description": "Red"
45+
},
46+
{
47+
"name": "BAND_G",
48+
"common_name": "green",
49+
"description": "Green"
50+
},
51+
{
52+
"name": "BAND_B",
53+
"common_name": "blue",
54+
"description": "Blue"
55+
}
56+
],
57+
"alternate": {
58+
"public": {
59+
"href": "https://maxar-opendata.s3.amazonaws.com/events/BayofBengal-Cyclone-Mocha-May-23/ard/46/033111301201/2023-03-14/1040010082988200-visual.tif",
60+
"title": "Public Access"
61+
}
62+
},
63+
"proj:bbox": [
64+
384843.75,
65+
2374843.75,
66+
390156.25,
67+
2380156.25
68+
],
69+
"proj:shape": [
70+
17408,
71+
17408
72+
],
73+
"proj:transform": [
74+
0.30517578125,
75+
0,
76+
384843.75,
77+
0,
78+
-0.30517578125,
79+
2380156.25,
80+
0,
81+
0,
82+
1
83+
]
84+
},
85+
"data-mask": {
86+
"href": "s3://maxar-opendata/events/BayofBengal-Cyclone-Mocha-May-23/ard/46/033111301201/2023-03-14/1040010082988200-data-mask.gpkg",
87+
"type": "application/geopackage+sqlite3",
88+
"roles": [
89+
"data-mask"
90+
],
91+
"title": "Data Mask",
92+
"alternate": {
93+
"public": {
94+
"href": "https://maxar-opendata.s3.amazonaws.com/events/BayofBengal-Cyclone-Mocha-May-23/ard/46/033111301201/2023-03-14/1040010082988200-data-mask.gpkg",
95+
"title": "Public Access"
96+
}
97+
}
98+
},
99+
"ms_analytic": {
100+
"href": "s3://maxar-opendata/events/BayofBengal-Cyclone-Mocha-May-23/ard/46/033111301201/2023-03-14/1040010082988200-ms.tif",
101+
"type": "image/tiff; application=geotiff; profile=cloud-optimized",
102+
"roles": [
103+
"data"
104+
],
105+
"title": "Multispectral Image",
106+
"eo:bands": [
107+
{
108+
"name": "BAND_C",
109+
"common_name": "coastal",
110+
"description": "Coastal Blue"
111+
},
112+
{
113+
"name": "BAND_B",
114+
"common_name": "blue",
115+
"description": "Blue"
116+
},
117+
{
118+
"name": "BAND_G",
119+
"common_name": "green",
120+
"description": "Green"
121+
},
122+
{
123+
"name": "BAND_Y",
124+
"common_name": "yellow",
125+
"description": "Yellow"
126+
},
127+
{
128+
"name": "BAND_R",
129+
"common_name": "red",
130+
"description": "Red"
131+
},
132+
{
133+
"name": "BAND_RE",
134+
"common_name": "rededge",
135+
"description": "Red Edge 1"
136+
},
137+
{
138+
"name": "BAND_N",
139+
"common_name": "nir08",
140+
"description": "Near Infrared 1"
141+
},
142+
{
143+
"name": "BAND_N2",
144+
"common_name": "nir09",
145+
"description": "Near Infrared 2"
146+
}
147+
],
148+
"alternate": {
149+
"public": {
150+
"href": "https://maxar-opendata.s3.amazonaws.com/events/BayofBengal-Cyclone-Mocha-May-23/ard/46/033111301201/2023-03-14/1040010082988200-ms.tif",
151+
"title": "Public Access"
152+
}
153+
},
154+
"proj:bbox": [
155+
384843.75,
156+
2374843.75,
157+
390156.25,
158+
2380156.25
159+
],
160+
"proj:shape": [
161+
3993,
162+
3993
163+
],
164+
"proj:transform": [
165+
1.3304532932632107,
166+
0,
167+
384843.75,
168+
0,
169+
-1.3304532932632107,
170+
2380156.25,
171+
0,
172+
0,
173+
1
174+
]
175+
},
176+
"pan_analytic": {
177+
"href": "s3://maxar-opendata/events/BayofBengal-Cyclone-Mocha-May-23/ard/46/033111301201/2023-03-14/1040010082988200-pan.tif",
178+
"type": "image/tiff; application=geotiff; profile=cloud-optimized",
179+
"roles": [
180+
"data"
181+
],
182+
"title": "Panchromatic Image",
183+
"eo:bands": [
184+
{
185+
"name": "BAND_P",
186+
"description": "Pan"
187+
}
188+
],
189+
"alternate": {
190+
"public": {
191+
"href": "https://maxar-opendata.s3.amazonaws.com/events/BayofBengal-Cyclone-Mocha-May-23/ard/46/033111301201/2023-03-14/1040010082988200-pan.tif",
192+
"title": "Public Access"
193+
}
194+
},
195+
"proj:bbox": [
196+
384843.75,
197+
2374843.75,
198+
390156.25,
199+
2380156.25
200+
],
201+
"proj:shape": [
202+
15972,
203+
15972
204+
],
205+
"proj:transform": [
206+
0.3326133233158027,
207+
0,
208+
384843.75,
209+
0,
210+
-0.3326133233158027,
211+
2380156.25,
212+
0,
213+
0,
214+
1
215+
]
216+
}
217+
},
218+
"geometry": {
219+
"type": "Polygon",
220+
"coordinates": [
221+
[
222+
[
223+
91.88812130564935,
224+
21.520425546284702
225+
],
226+
[
227+
91.939408735678,
228+
21.520759340266974
229+
],
230+
[
231+
91.93942487240946,
232+
21.518532895453674
233+
],
234+
[
235+
91.88813292057566,
236+
21.518896903912832
237+
],
238+
[
239+
91.88812130564935,
240+
21.520425546284702
241+
]
242+
]
243+
]
244+
},
245+
"collection": "MAXAR_BayofBengal_Cyclone_Mocha_May_23",
246+
"properties": {
247+
"gsd": 0.34,
248+
"quadkey": "033111301201",
249+
"datetime": "2023-03-14T04:30:25Z",
250+
"platform": "WV03",
251+
"utm_zone": 46,
252+
"grid:code": "MXRA-Z46-033111301201",
253+
"proj:bbox": [
254+
384843.75,
255+
2379910.40011545,
256+
390156.25,
257+
2380156.25
258+
],
259+
"proj:epsg": 32646,
260+
"catalog_id": "1040010082988200",
261+
"view:azimuth": 161.9,
262+
"proj:geometry": {
263+
"type": "Polygon",
264+
"coordinates": [
265+
[
266+
[
267+
384843.75,
268+
2380156.25
269+
],
270+
[
271+
390156.25,
272+
2380156.25
273+
],
274+
[
275+
390156.25,
276+
2379910.40011545
277+
],
278+
[
279+
384843.75,
280+
2379988.3126768884
281+
],
282+
[
283+
384843.75,
284+
2380156.25
285+
]
286+
]
287+
]
288+
},
289+
"tile:data_area": 1,
290+
"view:off_nadir": 19.5,
291+
"tile:clouds_area": 0,
292+
"view:sun_azimuth": 134.3,
293+
"view:sun_elevation": 57.2,
294+
"tile:clouds_percent": 0,
295+
"ard_metadata_version": "0.0.1",
296+
"view:incidence_angle": 68.5
297+
},
298+
"stac_version": "1.0.0",
299+
"stac_extensions": [
300+
"https://stac-extensions.github.io/view/v1.0.0/schema.json",
301+
"https://stac-extensions.github.io/projection/v1.0.0/schema.json",
302+
"https://stac-extensions.github.io/eo/v1.0.0/schema.json",
303+
"https://stac-extensions.github.io/raster/v1.1.0/schema.json",
304+
"https://stac-extensions.github.io/grid/v1.0.0/schema.json",
305+
"https://stac-extensions.github.io/alternate-assets/v1.1.0/schema.json"
306+
]
307+
}

tests/test_app.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,12 @@ def test_docs(app):
7070
response = app.get("/api.html")
7171
assert response.status_code == 200
7272
assert "text/html" in response.headers["content-type"]
73+
74+
75+
def test_debug(app):
76+
"""Test / endpoint."""
77+
response = app.get("/debug")
78+
assert response.status_code == 200
79+
assert response.headers["content-type"] == "application/json"
80+
body = response.json()
81+
assert body["url"] == "http://something.stac"

0 commit comments

Comments
 (0)