1
+ import time
1
2
from datetime import datetime , timedelta
2
3
3
4
import pytest
@@ -69,14 +70,13 @@ def test_app_transaction_extension(app_client, load_test_data, es_transactions):
69
70
item = load_test_data ("test_item.json" )
70
71
resp = app_client .post (f"/collections/{ item ['collection' ]} /items" , json = item )
71
72
assert resp .status_code == 200
72
-
73
+ time . sleep ( 1 )
73
74
es_transactions .delete_item (
74
75
item ["id" ], item ["collection" ], request = MockStarletteRequest
75
76
)
76
77
77
78
78
79
def test_app_search_response (load_test_data , app_client , es_transactions ):
79
-
80
80
item = load_test_data ("test_item.json" )
81
81
es_transactions .create_item (item , request = MockStarletteRequest )
82
82
@@ -94,7 +94,6 @@ def test_app_search_response(load_test_data, app_client, es_transactions):
94
94
)
95
95
96
96
97
- @pytest .mark .skip (reason = "this all passes manually?? assert 0 == 1" )
98
97
def test_app_context_extension (load_test_data , app_client , es_transactions , es_core ):
99
98
item = load_test_data ("test_item.json" )
100
99
collection = load_test_data ("test_collection.json" )
@@ -104,6 +103,8 @@ def test_app_context_extension(load_test_data, app_client, es_transactions, es_c
104
103
es_transactions .create_collection (collection , request = MockStarletteRequest )
105
104
es_transactions .create_item (item , request = MockStarletteRequest )
106
105
106
+ time .sleep (1 )
107
+
107
108
resp = app_client .get (f"/collections/{ collection ['id' ]} /items/{ item ['id' ]} " )
108
109
assert resp .status_code == 200
109
110
resp_json = resp .json ()
@@ -115,7 +116,7 @@ def test_app_context_extension(load_test_data, app_client, es_transactions, es_c
115
116
resp_json = resp .json ()
116
117
assert resp_json ["id" ] == collection ["id" ]
117
118
118
- resp = app_client .post ("/search" , json = {"collections" : ["test-collection" ]})
119
+ resp = app_client .post ("/search" , json = {"collections" : ["test-collection-2 " ]})
119
120
assert resp .status_code == 200
120
121
resp_json = resp .json ()
121
122
assert len (resp_json ["features" ]) == 1
@@ -159,11 +160,10 @@ def test_app_query_extension_gt(load_test_data, app_client, es_transactions):
159
160
)
160
161
161
162
162
- @pytest .mark .skip (reason = "assert 0 == 1" )
163
163
def test_app_query_extension_gte (load_test_data , app_client , es_transactions ):
164
164
test_item = load_test_data ("test_item.json" )
165
165
es_transactions .create_item (test_item , request = MockStarletteRequest )
166
-
166
+ time . sleep ( 1 )
167
167
params = {"query" : {"proj:epsg" : {"gte" : test_item ["properties" ]["proj:epsg" ]}}}
168
168
resp = app_client .post ("/search" , json = params )
169
169
assert resp .status_code == 200
@@ -212,14 +212,18 @@ def test_app_query_extension_limit_10000(load_test_data, app_client, es_transact
212
212
)
213
213
214
214
215
- @pytest .mark .skip (reason = "sort not fully implemented" )
215
+ @pytest .mark .skip (
216
+ reason = "No mapping found for [properties__datetime.keyword] in order to sort on"
217
+ )
216
218
def test_app_sort_extension (load_test_data , app_client , es_transactions ):
217
219
first_item = load_test_data ("test_item.json" )
218
220
item_date = datetime .strptime (
219
221
first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ"
220
222
)
221
223
es_transactions .create_item (first_item , request = MockStarletteRequest )
222
224
225
+ time .sleep (1 )
226
+
223
227
second_item = load_test_data ("test_item.json" )
224
228
second_item ["id" ] = "another-item"
225
229
another_item_date = item_date - timedelta (days = 1 )
@@ -228,6 +232,8 @@ def test_app_sort_extension(load_test_data, app_client, es_transactions):
228
232
)
229
233
es_transactions .create_item (second_item , request = MockStarletteRequest )
230
234
235
+ time .sleep (1 )
236
+
231
237
params = {
232
238
"collections" : [first_item ["collection" ]],
233
239
"sortby" : [{"field" : "datetime" , "direction" : "desc" }],
@@ -263,11 +269,11 @@ def test_search_invalid_date(load_test_data, app_client, es_transactions):
263
269
)
264
270
265
271
266
- @pytest .mark .skip (reason = "assert 0 == 1" )
267
272
def test_search_point_intersects (load_test_data , app_client , es_transactions ):
268
273
item = load_test_data ("test_item.json" )
269
274
es_transactions .create_item (item , request = MockStarletteRequest )
270
275
276
+ time .sleep (2 )
271
277
point = [150.04 , - 33.14 ]
272
278
intersects = {"type" : "Point" , "coordinates" : point }
273
279
@@ -276,19 +282,20 @@ def test_search_point_intersects(load_test_data, app_client, es_transactions):
276
282
"collections" : [item ["collection" ]],
277
283
}
278
284
resp = app_client .post ("/search" , json = params )
279
- es_transactions .delete_item (
280
- item ["id" ], item ["collection" ], request = MockStarletteRequest
281
- )
282
285
283
286
assert resp .status_code == 200
284
287
resp_json = resp .json ()
285
288
assert len (resp_json ["features" ]) == 1
286
289
290
+ es_transactions .delete_item (
291
+ item ["id" ], item ["collection" ], request = MockStarletteRequest
292
+ )
293
+
287
294
288
- @pytest .mark .skip (reason = "unknown" )
289
295
def test_datetime_non_interval (load_test_data , app_client , es_transactions ):
290
296
item = load_test_data ("test_item.json" )
291
297
es_transactions .create_item (item , request = MockStarletteRequest )
298
+ time .sleep (2 )
292
299
alternate_formats = [
293
300
"2020-02-12T12:30:22+00:00" ,
294
301
"2020-02-12T12:30:22.00Z" ,
@@ -312,10 +319,10 @@ def test_datetime_non_interval(load_test_data, app_client, es_transactions):
312
319
)
313
320
314
321
315
- @pytest .mark .skip (reason = "unknown" )
316
322
def test_bbox_3d (load_test_data , app_client , es_transactions ):
317
323
item = load_test_data ("test_item.json" )
318
324
es_transactions .create_item (item , request = MockStarletteRequest )
325
+ time .sleep (1 )
319
326
320
327
australia_bbox = [106.343365 , - 47.199523 , 0.1 , 168.218365 , - 19.437288 , 0.1 ]
321
328
params = {
@@ -331,10 +338,10 @@ def test_bbox_3d(load_test_data, app_client, es_transactions):
331
338
)
332
339
333
340
334
- @pytest .mark .skip (reason = "unknown" )
335
341
def test_search_line_string_intersects (load_test_data , app_client , es_transactions ):
336
342
item = load_test_data ("test_item.json" )
337
343
es_transactions .create_item (item , request = MockStarletteRequest )
344
+ time .sleep (2 )
338
345
339
346
line = [[150.04 , - 33.14 ], [150.22 , - 33.89 ]]
340
347
intersects = {"type" : "LineString" , "coordinates" : line }
0 commit comments