Skip to content

Commit bf8fd95

Browse files
committed
add item collection datetime test
1 parent 90108f8 commit bf8fd95

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

stac_fastapi/elasticsearch/tests/resources/test_item.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ async def test_get_item_collection(app_client, ctx, txn_client):
191191
assert matched == item_count + 1
192192

193193

194-
async def test_item_collection_filter_bbox(app_client, ctx, txn_client):
194+
async def test_item_collection_filter_bbox(app_client, ctx):
195195
item = ctx.item
196196
collection = item["collection"]
197197

@@ -208,30 +208,26 @@ async def test_item_collection_filter_bbox(app_client, ctx, txn_client):
208208
assert len(resp_json["features"]) == 0
209209

210210

211-
# def test_item_collection_filter_datetime(
212-
# load_test_data, app_client, postgres_transactions
213-
# ):
214-
# item = load_test_data("test_item.json")
215-
# collection = item["collection"]
216-
# postgres_transactions.create_item(
217-
# item["collection"], item, request=MockStarletteRequest
218-
# )
219-
220-
# datetime_range = "2020-01-01T00:00:00.00Z/.."
221-
# resp = app_client.get(
222-
# f"/collections/{collection}/items", params={"datetime": datetime_range}
223-
# )
224-
# assert resp.status_code == 200
225-
# resp_json = resp.json()
226-
# assert len(resp_json["features"]) == 1
227-
228-
# datetime_range = "2018-01-01T00:00:00.00Z/2019-01-01T00:00:00.00Z"
229-
# resp = app_client.get(
230-
# f"/collections/{collection}/items", params={"datetime": datetime_range}
231-
# )
232-
# assert resp.status_code == 200
233-
# resp_json = resp.json()
234-
# assert len(resp_json["features"]) == 0
211+
async def test_item_collection_filter_datetime(app_client, ctx):
212+
item = ctx.item
213+
collection = item["collection"]
214+
215+
datetime_range = "2020-01-01T00:00:00.00Z/.."
216+
resp = await app_client.get(
217+
f"/collections/{collection}/items", params={"datetime": datetime_range}
218+
)
219+
assert resp.status_code == 200
220+
resp_json = resp.json()
221+
assert len(resp_json["features"]) == 1
222+
223+
datetime_range = "2018-01-01T00:00:00.00Z/2019-01-01T00:00:00.00Z"
224+
resp = await app_client.get(
225+
f"/collections/{collection}/items", params={"datetime": datetime_range}
226+
)
227+
assert resp.status_code == 200
228+
resp_json = resp.json()
229+
assert len(resp_json["features"]) == 0
230+
235231

236232
@pytest.mark.skip(reason="Pagination extension not implemented")
237233
async def test_pagination(app_client, load_test_data):

0 commit comments

Comments
 (0)