Skip to content

Commit

Permalink
Explicit test that geojson is stored and retrieved in mongo correctly #…
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Jul 25, 2022
1 parent c3c75b9 commit f9d55e1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions data-serving/reusable-data-service/tests/test_case_end_to_end.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import bson
import freezegun
import json
import pymongo

from datetime import datetime
Expand Down Expand Up @@ -194,6 +195,20 @@ def test_post_case_list_cases_round_trip(client_with_patched_mongo):
assert get_response.json["cases"][0]["confirmationDate"] == "2022-01-23"


def test_post_case_list_cases_geojson_round_trip(client_with_patched_mongo):
with open("./tests/data/case.with_location.json", "r") as file:
case_json = json.load(file)
post_response = client_with_patched_mongo.post(
"/api/cases",
json=case_json,
)
assert post_response.status_code == 201
get_response = client_with_patched_mongo.get("/api/cases")
assert get_response.status_code == 200
assert len(get_response.json["cases"]) == 1
assert get_response.json["cases"][0]["location"]["properties"]["country"] == "IND"


def test_post_multiple_case_list_cases_round_trip(client_with_patched_mongo):
post_response = client_with_patched_mongo.post(
"/api/cases?num_cases=3",
Expand Down

0 comments on commit f9d55e1

Please sign in to comment.