-
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
bb680ed
commit 1b842d0
Showing
2 changed files
with
45 additions
and
3 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 @@ | ||
"""Test FastAPI endpoint function.""" | ||
|
||
import re | ||
from datetime import datetime | ||
|
||
import pytest | ||
from fastapi.testclient import TestClient | ||
|
||
from gene.main import app | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def api_client(): | ||
"""Provide test API client""" | ||
return TestClient(app) | ||
|
||
|
||
def test_service_info(api_client: TestClient): | ||
"""Test /service_info endpoint""" | ||
response = api_client.get("/gene/service_info") | ||
assert response.status_code == 200 | ||
expected_version_pattern = r"\d\.\d\." | ||
response_json = response.json() | ||
assert response_json["id"] == "org.genomicmedlab.gene-normalizer" | ||
assert response_json["name"] == "Gene Normalizer" | ||
assert response_json["type"]["group"] == "org.genomicmedlab" | ||
assert response_json["type"]["artifact"] == "Gene Normalizer API" | ||
assert re.match(expected_version_pattern, response_json["type"]["version"]) | ||
assert ( | ||
response_json["description"] | ||
== "Tools for resolving ambiguous gene symbols to richly-annotated concepts" | ||
) | ||
assert response_json["organization"] == { | ||
"name": "Genomic Medicine Lab at Nationwide Children's Hospital", | ||
"url": "https://www.nationwidechildrens.org/specialties/institute-for-genomic-medicine/research-labs/wagner-lab", | ||
} | ||
assert response_json["contactUrl"] == "[email protected]" | ||
assert ( | ||
response_json["documentationUrl"] == "https://gene-normalizer.readthedocs.io/" | ||
) | ||
assert datetime.fromisoformat(response_json["createdAt"]) | ||
assert re.match(expected_version_pattern, response_json["version"]) |