-
Notifications
You must be signed in to change notification settings - Fork 0
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
8eb2bfb
commit 9f6c5de
Showing
2 changed files
with
43 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,42 @@ | ||
"""Perform basic tests of endpoint branches. | ||
We already have tests and data validation to ensure correctness of the underlying | ||
response objects -- here, we're checking for bad branch logic and for basic assurances | ||
that routes integrate correctly with query methods. | ||
""" | ||
import pytest | ||
from fastapi.testclient import TestClient | ||
|
||
from disease.main import app | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def api_client(): | ||
"""Provide test client fixture.""" | ||
return TestClient(app) | ||
|
||
|
||
def test_search(api_client): | ||
"""Test /search endpoint.""" | ||
response = api_client.get("/disease/search?q=neuroblastoma") | ||
assert response.status_code == 200 | ||
assert ( | ||
response.json()["source_matches"]["Mondo"]["records"][0]["concept_id"] | ||
== "mondo:0005072" | ||
) | ||
|
||
response = api_client.get("/disease/search?q=neuroblastoma&incl=sdkl") | ||
assert response.status_code == 422 | ||
|
||
|
||
def test_normalize(api_client): | ||
"""Test /normalize endpoint.""" | ||
response = api_client.get("/disease/normalize?q=neuroblastoma") | ||
assert response.status_code == 200 | ||
assert response.json()["normalized_id"] == "ncit:C3270" | ||
|
||
|
||
def test_normalize_unmerged(api_client): | ||
"""Test /normalize_unmerged endpoint.""" | ||
response = api_client.get("/disease/normalize_unmerged?q=neuroblastoma") | ||
assert response.status_code == 200 | ||
assert response.json()["normalized_concept_id"] == "ncit:C3270" |