-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
8346376
commit 6bf3535
Showing
3 changed files
with
68 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Test the API of liquefaction_api.py. | ||
""" | ||
|
||
import pytest | ||
from fastapi.testclient import TestClient | ||
|
||
# Will the .. be stable? | ||
from ..main import app | ||
|
||
|
||
@pytest.fixture | ||
def client(): | ||
return TestClient(app) | ||
|
||
|
||
def test_is_in_liquefaction_zone(client): | ||
lat, lon = [37.779759, -122.407436] | ||
response = client.get( | ||
f"/api/liquefaction-zones/is-in-liquefaction-zone?lat={lat}&lon={lon}" | ||
) | ||
assert response.status_code == 200 | ||
assert response.json() # True | ||
|
||
# These should not be in liquefaction zones | ||
wrong_lat, wrong_lon = [0.0, 0.0] | ||
response = client.get( | ||
f"/api/liquefaction-zones/is-in-liquefaction-zone?lat={wrong_lat}&lon={wrong_lon}" | ||
) | ||
assert response.status_code == 200 | ||
assert not response.json() # False |
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