-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christopher J Lowrie
authored and
Christopher J Lowrie
committed
Aug 22, 2024
1 parent
c5c1215
commit 2e4bf07
Showing
5 changed files
with
152 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
from app.googleflood import get_google_floods_gauges | ||
from app.googleflood import get_google_floods_gauges, get_google_floods_inundations | ||
from app.main import app | ||
from fastapi.testclient import TestClient | ||
import logging, json | ||
|
||
client = TestClient(app) | ||
|
||
test_inundation_map_set = [{'level': 'HIGH', 'serializedPolygonId': '9631a3143f2543ae9664c4fba7298931'}, {'level': 'MEDIUM', 'serializedPolygonId': '93444f067f42409493fd907b2b0323b7'}, {'level': 'LOW', 'serializedPolygonId': '757ac60c06ea481aba384201a107d611'}] | ||
test_inundation_map_set_jsonstr = json.dumps(test_inundation_map_set) | ||
|
||
def test_get_google_floods_gauges(): | ||
gauges = get_google_floods_gauges("BD") | ||
assert len(gauges) > 0 | ||
|
||
|
||
def test_get_google_floods_inundations(): | ||
floods = get_google_floods_inundations(test_inundation_map_set) | ||
assert floods.shape[0] > 0 | ||
|
||
|
||
def test_get_google_floods_gauges_api(): | ||
response = client.get("/google-floods-gauges?iso2=BD") | ||
assert response.status_code == 200 | ||
logging.info(json.dumps(response.json())) | ||
# logging.info(response.json()) | ||
assert len(response.json()) > 0 | ||
|
||
|
||
|
||
def test_get_google_floods_inundation_api(): | ||
response = client.get(f"/google-floods-inundations?inundationMapSet_JSONString={test_inundation_map_set_jsonstr}") | ||
assert response.status_code == 200 | ||
logging.info(json.dumps(response.json())) | ||
# logging.info(response.json()) | ||
assert len(response.json()) > 0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters