From d5d204c642d054b34367f308188b852ea80cba50 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Fri, 14 Nov 2025 10:27:10 +0200 Subject: [PATCH] Add tests for the health endpoint. --- tests/__init__.py | 0 tests/conftest.py | 10 ++++++++++ tests/test_health_check.py | 17 +++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/conftest.py create mode 100644 tests/test_health_check.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..39a9464 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,10 @@ +import pytest +import requests + +BASE_URL = "http://localhost:8000" + + +@pytest.fixture(scope="session") +def api_client(): + """Fixture for API client""" + return requests.Session() diff --git a/tests/test_health_check.py b/tests/test_health_check.py new file mode 100644 index 0000000..a3ed195 --- /dev/null +++ b/tests/test_health_check.py @@ -0,0 +1,17 @@ +import pytest +import requests +from typing import Dict, Any +from .conftest import BASE_URL + + +class TestHealthCheck: + """health check endpoint""" + + def test_health_endpoint(self, api_client): + """For /health endpoint""" + response = api_client.get(f"{BASE_URL}/health") + assert response.status_code == 200 + data = response.json() + assert "status" in data + assert data["status"] == "healthy" + assert "model_loaded" in data