Coverage for skema/rest/tests/test_core.py: 100%
27 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-30 17:15 +0000
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-30 17:15 +0000
1import pytest
2from fastapi.testclient import TestClient
3from skema.rest.api import app
5@pytest.fixture
6def client():
7 return TestClient(app)
9def test_version_endpoint(client):
10 """Unit test for version endpoint"""
11 response = client.get("/version")
12 assert response.status_code == 200
14def test_healthcheck_endpoint(client):
15 """Unit test for healthcheck endpoint"""
16 response = client.get("/healthcheck")
17 assert response.status_code in [200, 500]
19def test_environment_variables_endpoint(client):
20 """Unit test for environment-variables endpoint"""
21 response = client.get("/environment-variables")
22 assert response.status_code == 200
24 env_vars = response.json()
25 assert "SKEMA_GRAPH_DB_PROTO" in env_vars
26 assert "SKEMA_GRAPH_DB_HOST" in env_vars
27 assert "SKEMA_GRAPH_DB_PORT" in env_vars
28 assert "SKEMA_RS_ADDRESS" in env_vars
30 assert "SKEMA_MATHJAX_PROTOCOL" in env_vars
31 assert "SKEMA_MATHJAX_HOST" in env_vars
32 assert "SKEMA_MATHJAX_PORT" in env_vars
33 assert "SKEMA_MATHJAX_ADDRESS" in env_vars
35 assert "MIT_TR_ADDRESS" in env_vars
36 assert "SKEMA_TR_ADDRESS" in env_vars
37 assert "COSMOS_ADDRESS" in env_vars