spr migrated books, and tester
This commit is contained in:
1
station/tools/tester/tests/example/__init__.py
Normal file
1
station/tools/tester/tests/example/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# Example tests - used when no room-specific tests are configured
|
||||
36
station/tools/tester/tests/example/test_health.py
Normal file
36
station/tools/tester/tests/example/test_health.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""
|
||||
Example health check test.
|
||||
|
||||
This is a fallback test that works without room-specific configuration.
|
||||
Replace with room tests via cfg/<room>/tester/tests/
|
||||
"""
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
|
||||
class TestHealth:
|
||||
"""Basic health check tests."""
|
||||
|
||||
@pytest.fixture
|
||||
def base_url(self):
|
||||
"""Base URL for the API under test."""
|
||||
import os
|
||||
|
||||
return os.getenv("TEST_BASE_URL", "http://localhost:8000")
|
||||
|
||||
def test_health_endpoint(self, base_url):
|
||||
"""Test that /health endpoint responds."""
|
||||
try:
|
||||
response = httpx.get(f"{base_url}/health", timeout=5)
|
||||
assert response.status_code == 200
|
||||
except httpx.ConnectError:
|
||||
pytest.skip("API not running - set TEST_BASE_URL or start the service")
|
||||
|
||||
def test_root_endpoint(self, base_url):
|
||||
"""Test that root endpoint responds."""
|
||||
try:
|
||||
response = httpx.get(base_url, timeout=5)
|
||||
assert response.status_code in [200, 301, 302, 307, 308]
|
||||
except httpx.ConnectError:
|
||||
pytest.skip("API not running - set TEST_BASE_URL or start the service")
|
||||
Reference in New Issue
Block a user