Skip to content

Commit

Permalink
Merge branch 'staging' into pyproject
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson committed Oct 3, 2023
2 parents 3221755 + d2f7672 commit b4d3cca
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pre-commit = "*"
black = "*"
ruff = "*"
pytest-cov = "*"
httpx = "*"
mock = "*"
ipykernel = "*"
sphinx = "6.1.3"
Expand Down
43 changes: 43 additions & 0 deletions tests/unit/test_endpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""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 gene.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("/gene/search?q=braf")
assert response.status_code == 200
assert (
response.json()["source_matches"]["HGNC"]["records"][0]["concept_id"]
== "hgnc:1097"
)

response = api_client.get("/gene/search?q=braf&incl=sdkl")
assert response.status_code == 422


def test_normalize(api_client):
"""Test /normalize endpoint."""
response = api_client.get("/gene/normalize?q=braf")
assert response.status_code == 200
assert response.json()["normalized_id"] == "hgnc:1097"


def test_normalize_unmerged(api_client):
"""Test /normalize_unmerged endpoint."""
response = api_client.get("/gene/normalize_unmerged?q=braf")
assert response.status_code == 200
assert response.json()["normalized_concept_id"] == "hgnc:1097"

0 comments on commit b4d3cca

Please sign in to comment.