33
33
}
34
34
35
35
36
+ @pytest .mark .asyncio
36
37
async def test_post_search_content_type (app_client , ctx ):
37
38
params = {"limit" : 1 }
38
39
resp = await app_client .post ("/search" , json = params )
39
40
assert resp .headers ["content-type" ] == "application/geo+json"
40
41
41
42
43
+ @pytest .mark .asyncio
42
44
async def test_get_search_content_type (app_client , ctx ):
43
45
resp = await app_client .get ("/search" )
44
46
assert resp .headers ["content-type" ] == "application/geo+json"
45
47
46
48
49
+ @pytest .mark .asyncio
47
50
async def test_api_headers (app_client ):
48
51
resp = await app_client .get ("/api" )
49
52
assert (
@@ -52,11 +55,13 @@ async def test_api_headers(app_client):
52
55
assert resp .status_code == 200
53
56
54
57
58
+ @pytest .mark .asyncio
55
59
async def test_router (app ):
56
60
api_routes = set ([f"{ list (route .methods )[0 ]} { route .path } " for route in app .routes ])
57
61
assert len (api_routes - ROUTES ) == 0
58
62
59
63
64
+ @pytest .mark .asyncio
60
65
async def test_app_transaction_extension (app_client , ctx ):
61
66
item = copy .deepcopy (ctx .item )
62
67
item ["id" ] = str (uuid .uuid4 ())
@@ -66,6 +71,7 @@ async def test_app_transaction_extension(app_client, ctx):
66
71
await app_client .delete (f"/collections/{ item ['collection' ]} /items/{ item ['id' ]} " )
67
72
68
73
74
+ @pytest .mark .asyncio
69
75
async def test_app_search_response (app_client , ctx ):
70
76
resp = await app_client .get ("/search" , params = {"ids" : ["test-item" ]})
71
77
assert resp .status_code == 200
@@ -77,6 +83,7 @@ async def test_app_search_response(app_client, ctx):
77
83
assert resp_json .get ("stac_extensions" ) is None
78
84
79
85
86
+ @pytest .mark .asyncio
80
87
async def test_app_context_extension (app_client , ctx , txn_client ):
81
88
test_item = ctx .item
82
89
test_item ["id" ] = "test-item-2"
@@ -110,13 +117,15 @@ async def test_app_context_extension(app_client, ctx, txn_client):
110
117
assert matched == 1
111
118
112
119
120
+ @pytest .mark .asyncio
113
121
async def test_app_fields_extension (app_client , ctx , txn_client ):
114
122
resp = await app_client .get ("/search" , params = {"collections" : ["test-collection" ]})
115
123
assert resp .status_code == 200
116
124
resp_json = resp .json ()
117
125
assert list (resp_json ["features" ][0 ]["properties" ]) == ["datetime" ]
118
126
119
127
128
+ @pytest .mark .asyncio
120
129
async def test_app_fields_extension_query (app_client , ctx , txn_client ):
121
130
resp = await app_client .post (
122
131
"/search" ,
@@ -130,6 +139,7 @@ async def test_app_fields_extension_query(app_client, ctx, txn_client):
130
139
assert list (resp_json ["features" ][0 ]["properties" ]) == ["datetime" , "proj:epsg" ]
131
140
132
141
142
+ @pytest .mark .asyncio
133
143
async def test_app_fields_extension_no_properties_get (app_client , ctx , txn_client ):
134
144
resp = await app_client .get (
135
145
"/search" , params = {"collections" : ["test-collection" ], "fields" : "-properties" }
@@ -139,6 +149,7 @@ async def test_app_fields_extension_no_properties_get(app_client, ctx, txn_clien
139
149
assert "properties" not in resp_json ["features" ][0 ]
140
150
141
151
152
+ @pytest .mark .asyncio
142
153
async def test_app_fields_extension_no_properties_post (app_client , ctx , txn_client ):
143
154
resp = await app_client .post (
144
155
"/search" ,
@@ -152,6 +163,7 @@ async def test_app_fields_extension_no_properties_post(app_client, ctx, txn_clie
152
163
assert "properties" not in resp_json ["features" ][0 ]
153
164
154
165
166
+ @pytest .mark .asyncio
155
167
async def test_app_fields_extension_return_all_properties (app_client , ctx , txn_client ):
156
168
item = ctx .item
157
169
resp = await app_client .get (
@@ -168,6 +180,7 @@ async def test_app_fields_extension_return_all_properties(app_client, ctx, txn_c
168
180
assert feature ["properties" ][expected_prop ] == expected_value
169
181
170
182
183
+ @pytest .mark .asyncio
171
184
async def test_app_query_extension_gt (app_client , ctx ):
172
185
params = {"query" : {"proj:epsg" : {"gt" : ctx .item ["properties" ]["proj:epsg" ]}}}
173
186
resp = await app_client .post ("/search" , json = params )
@@ -176,6 +189,7 @@ async def test_app_query_extension_gt(app_client, ctx):
176
189
assert len (resp_json ["features" ]) == 0
177
190
178
191
192
+ @pytest .mark .asyncio
179
193
async def test_app_query_extension_gte (app_client , ctx ):
180
194
params = {"query" : {"proj:epsg" : {"gte" : ctx .item ["properties" ]["proj:epsg" ]}}}
181
195
resp = await app_client .post ("/search" , json = params )
@@ -184,22 +198,26 @@ async def test_app_query_extension_gte(app_client, ctx):
184
198
assert len (resp .json ()["features" ]) == 1
185
199
186
200
201
+ @pytest .mark .asyncio
187
202
async def test_app_query_extension_limit_lt0 (app_client ):
188
203
assert (await app_client .post ("/search" , json = {"limit" : - 1 })).status_code == 400
189
204
190
205
206
+ @pytest .mark .asyncio
191
207
async def test_app_query_extension_limit_gt10000 (app_client ):
192
208
resp = await app_client .post ("/search" , json = {"limit" : 10001 })
193
209
assert resp .status_code == 200
194
210
assert resp .json ()["context" ]["limit" ] == 10000
195
211
196
212
213
+ @pytest .mark .asyncio
197
214
async def test_app_query_extension_limit_10000 (app_client ):
198
215
params = {"limit" : 10000 }
199
216
resp = await app_client .post ("/search" , json = params )
200
217
assert resp .status_code == 200
201
218
202
219
220
+ @pytest .mark .asyncio
203
221
async def test_app_sort_extension (app_client , txn_client , ctx ):
204
222
first_item = ctx .item
205
223
item_date = datetime .strptime (
@@ -225,6 +243,7 @@ async def test_app_sort_extension(app_client, txn_client, ctx):
225
243
assert resp_json ["features" ][1 ]["id" ] == second_item ["id" ]
226
244
227
245
246
+ @pytest .mark .asyncio
228
247
async def test_search_invalid_date (app_client , ctx ):
229
248
params = {
230
249
"datetime" : "2020-XX-01/2020-10-30" ,
@@ -272,6 +291,7 @@ async def test_search_point_intersects_post(app_client, ctx):
272
291
assert len (resp_json ["features" ]) == 1
273
292
274
293
294
+ @pytest .mark .asyncio
275
295
async def test_search_point_does_not_intersect (app_client , ctx ):
276
296
point = [15.04 , - 3.14 ]
277
297
intersects = {"type" : "Point" , "coordinates" : point }
@@ -287,6 +307,7 @@ async def test_search_point_does_not_intersect(app_client, ctx):
287
307
assert len (resp_json ["features" ]) == 0
288
308
289
309
310
+ @pytest .mark .asyncio
290
311
async def test_datetime_non_interval (app_client , ctx ):
291
312
dt_formats = [
292
313
"2020-02-12T12:30:22+00:00" ,
@@ -308,6 +329,7 @@ async def test_datetime_non_interval(app_client, ctx):
308
329
assert resp_json ["features" ][0 ]["properties" ]["datetime" ][0 :19 ] == dt [0 :19 ]
309
330
310
331
332
+ @pytest .mark .asyncio
311
333
async def test_bbox_3d (app_client , ctx ):
312
334
australia_bbox = [106.343365 , - 47.199523 , 0.1 , 168.218365 , - 19.437288 , 0.1 ]
313
335
params = {
@@ -320,6 +342,7 @@ async def test_bbox_3d(app_client, ctx):
320
342
assert len (resp_json ["features" ]) == 1
321
343
322
344
345
+ @pytest .mark .asyncio
323
346
async def test_search_line_string_intersects (app_client , ctx ):
324
347
line = [[150.04 , - 33.14 ], [150.22 , - 33.89 ]]
325
348
intersects = {"type" : "LineString" , "coordinates" : line }
0 commit comments