Skip to content

Commit

Permalink
Add test cases for different fileformats
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Feb 21, 2024
1 parent 873b606 commit 212efbe
Showing 1 changed file with 146 additions and 2 deletions.
148 changes: 146 additions & 2 deletions tests/test_API.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,10 @@ def test_snapshot_feature():
wait_for_task_completion(track_link)


def test_snapshot_feature_fgb_wrap_geom():
def test_snapshot_feature_fgb():
response = client.post(
"/v1/snapshot/",
json={
"fgbWrapGeoms": True,
"outputType": "fgb",
"geometry": {
"type": "Feature",
Expand All @@ -187,6 +186,151 @@ def test_snapshot_feature_fgb_wrap_geom():
wait_for_task_completion(track_link)


def test_snapshot_feature_shp():
response = client.post(
"/v1/snapshot/",
json={
"outputType": "shp",
"geometry": {
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[83.97346137271688, 28.217525272345284],
[83.97346137271688, 28.192595937414737],
[84.01473909818759, 28.192595937414737],
[84.01473909818759, 28.217525272345284],
[83.97346137271688, 28.217525272345284],
]
],
"type": "Polygon",
},
},
},
)
assert response.status_code == 200
res = response.json()
track_link = res["track_link"]
wait_for_task_completion(track_link)


def test_snapshot_feature_gpkg():
response = client.post(
"/v1/snapshot/",
json={
"outputType": "gpkg",
"geometry": {
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[83.97346137271688, 28.217525272345284],
[83.97346137271688, 28.192595937414737],
[84.01473909818759, 28.192595937414737],
[84.01473909818759, 28.217525272345284],
[83.97346137271688, 28.217525272345284],
]
],
"type": "Polygon",
},
},
},
)
assert response.status_code == 200
res = response.json()
track_link = res["track_link"]
wait_for_task_completion(track_link)


def test_snapshot_feature_kml():
response = client.post(
"/v1/snapshot/",
json={
"outputType": "kml",
"geometry": {
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[83.97346137271688, 28.217525272345284],
[83.97346137271688, 28.192595937414737],
[84.01473909818759, 28.192595937414737],
[84.01473909818759, 28.217525272345284],
[83.97346137271688, 28.217525272345284],
]
],
"type": "Polygon",
},
},
},
)
assert response.status_code == 200
res = response.json()
track_link = res["track_link"]
wait_for_task_completion(track_link)


def test_snapshot_feature_sql():
response = client.post(
"/v1/snapshot/",
json={
"outputType": "sql",
"geometry": {
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[83.97346137271688, 28.217525272345284],
[83.97346137271688, 28.192595937414737],
[84.01473909818759, 28.192595937414737],
[84.01473909818759, 28.217525272345284],
[83.97346137271688, 28.217525272345284],
]
],
"type": "Polygon",
},
},
},
)
assert response.status_code == 200
res = response.json()
track_link = res["track_link"]
wait_for_task_completion(track_link)


def test_snapshot_feature_csv():
response = client.post(
"/v1/snapshot/",
json={
"outputType": "csv",
"geometry": {
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[83.97346137271688, 28.217525272345284],
[83.97346137271688, 28.192595937414737],
[84.01473909818759, 28.192595937414737],
[84.01473909818759, 28.217525272345284],
[83.97346137271688, 28.217525272345284],
]
],
"type": "Polygon",
},
},
},
)
assert response.status_code == 200
res = response.json()
track_link = res["track_link"]
wait_for_task_completion(track_link)


def test_snapshot_centroid():
response = client.post(
"/v1/snapshot/",
Expand Down

0 comments on commit 212efbe

Please sign in to comment.