Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

✅(summary) add minimal test suite for health endpoint

lebaudantoine83bd9c5ce34b
diff --git a/bin/pytest-summary b/bin/pytest-summary
new file mode 100755
index 00000000..29e32101
--- /dev/null
+++ b/bin/pytest-summary
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source "$(dirname "${BASH_SOURCE[0]}")/_config.sh"
+
+_dc_run \
+ app-summary-dev \
+ python -m pytest "$@"
diff --git a/src/summary/pyproject.toml b/src/summary/pyproject.toml
index bc300add..eb23f943 100644
--- a/src/summary/pyproject.toml
+++ b/src/summary/pyproject.toml
@@ -21,8 +21,16 @@ dependencies = [
[project.optional-dependencies]
dev = [
"ruff==0.14.4",
+ "pytest==9.0.2",
+ "responses>=0.25.8",
]
+[tool.pytest.ini_options]
+markers = [
+ "api: Test the API",
+]
+testpaths = ["tests"]
+
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
@@ -49,6 +57,7 @@ select = [
"T20", # flake8-print
"W", # pycodestyle warning
]
+ignore= ["PLR2004"]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
diff --git a/src/summary/tests/__init__.py b/src/summary/tests/__init__.py
new file mode 100644
index 00000000..224e5ad5
--- /dev/null
+++ b/src/summary/tests/__init__.py
@@ -0,0 +1 @@
+"""Tests for the summary service."""
diff --git a/src/summary/tests/api/__init__.py b/src/summary/tests/api/__init__.py
new file mode 100644
index 00000000..bce0b500
--- /dev/null
+++ b/src/summary/tests/api/__init__.py
@@ -0,0 +1 @@
+"""Tests for the API summary service."""
diff --git a/src/summary/tests/api/test_api_health.py b/src/summary/tests/api/test_api_health.py
new file mode 100644
index 00000000..0460b1d8
--- /dev/null
+++ b/src/summary/tests/api/test_api_health.py
@@ -0,0 +1,21 @@
+"""Integration tests for the health check endpoints."""
+
+
+class TestHeartbeat:
+ """Tests for the /__heartbeat__ endpoint."""
+
+ def test_returns_200(self, client):
+ """The heartbeat endpoint responds with 200 OK without a token."""
+ response = client.get("/__heartbeat__")
+
+ assert response.status_code == 200
+
+
+class TestLBHeartbeat:
+ """Tests for the /__lbheartbeat__ endpoint."""
+
+ def test_returns_200(self, client):
+ """The load-balancer heartbeat endpoint responds with 200 OK without a token."""
+ response = client.get("/__lbheartbeat__")
+
+ assert response.status_code == 200
diff --git a/src/summary/tests/conftest.py b/src/summary/tests/conftest.py
new file mode 100644
index 00000000..cbce00b9
--- /dev/null
+++ b/src/summary/tests/conftest.py
@@ -0,0 +1,12 @@
+"""Integration test configuration. Provides shared fixtures."""
+
+import pytest
+from fastapi.testclient import TestClient
+
+from summary.main import app
+
+
+def client():
+ """Provide a FastAPI TestClient for integration tests."""
+ return TestClient(app)