Skip to content

Commit 836bce0

Browse files
committed
add get polygon test
1 parent b983f28 commit 836bce0

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

stac_fastapi/elasticsearch/tests/api/test_api.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import uuid
33
from datetime import datetime, timedelta
44

5+
import pytest
6+
57
from ..conftest import create_collection, create_item
68

79
ROUTES = {
@@ -233,10 +235,21 @@ async def test_search_invalid_date(app_client, ctx):
233235
assert resp.status_code == 400
234236

235237

238+
@pytest.mark.asyncio
236239
async def test_search_point_intersects_get(app_client, ctx):
237-
point = [150.04, -33.14]
238240
resp = await app_client.get(
239-
f"/search?intersects={'type':'Point','coordinates':{point}}"
241+
'/search?intersects={"type":"Point","coordinates":[150.04,-33.14]}'
242+
)
243+
244+
assert resp.status_code == 200
245+
resp_json = resp.json()
246+
assert len(resp_json["features"]) == 1
247+
248+
249+
@pytest.mark.asyncio
250+
async def test_search_polygon_intersects_get(app_client, ctx):
251+
resp = await app_client.get(
252+
'/search?intersects={"type":"Polygon","coordinates":[[[149.04, -34.14],[149.04, -32.14],[151.04, -32.14],[151.04, -34.14],[149.04, -34.14]]]}'
240253
)
241254

242255
assert resp.status_code == 200

0 commit comments

Comments
 (0)