|
2 | 2 | import os
|
3 | 3 | import uuid
|
4 | 4 | from copy import deepcopy
|
5 |
| -from datetime import datetime, timedelta |
| 5 | +from datetime import datetime, timedelta, timezone |
6 | 6 | from random import randint
|
7 | 7 | from urllib.parse import parse_qs, urlparse, urlsplit
|
8 | 8 |
|
@@ -475,6 +475,31 @@ async def test_item_search_temporal_window_get(app_client, ctx):
|
475 | 475 | assert resp_json["features"][0]["id"] == test_item["id"]
|
476 | 476 |
|
477 | 477 |
|
| 478 | +@pytest.mark.asyncio |
| 479 | +async def test_item_search_temporal_window_timezone_get(app_client, ctx): |
| 480 | + """Test GET search with spatio-temporal query ending with Zulu and pagination(core)""" |
| 481 | + tzinfo = timezone(timedelta(hours=1)) |
| 482 | + test_item = ctx.item |
| 483 | + item_date = rfc3339_str_to_datetime(test_item["properties"]["datetime"]) |
| 484 | + item_date_before = item_date - timedelta(seconds=1) |
| 485 | + item_date_before = item_date_before.replace(tzinfo=tzinfo) |
| 486 | + item_date_after = item_date + timedelta(seconds=1) |
| 487 | + item_date_after = item_date_after.replace(tzinfo=tzinfo) |
| 488 | + |
| 489 | + params = { |
| 490 | + "collections": test_item["collection"], |
| 491 | + "bbox": ",".join([str(coord) for coord in test_item["bbox"]]), |
| 492 | + "datetime": f"{datetime_to_str(item_date_before)}/{datetime_to_str(item_date_after)}", |
| 493 | + } |
| 494 | + resp = await app_client.get("/search", params=params) |
| 495 | + resp_json = resp.json() |
| 496 | + next_link = next(link for link in resp_json["links"] if link["rel"] == "next")[ |
| 497 | + "href" |
| 498 | + ] |
| 499 | + resp = await app_client.get(next_link) |
| 500 | + assert resp.status_code == 200 |
| 501 | + |
| 502 | + |
478 | 503 | @pytest.mark.asyncio
|
479 | 504 | async def test_item_search_post_without_collection(app_client, ctx):
|
480 | 505 | """Test POST search without specifying a collection"""
|
|
0 commit comments