mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-03-28 17:42:56 +01:00
Merge pull request #4 from ipnet-mesh/claude/fix-config-defaults-01J6hLPHTuF9VMsrdiGes6s7
Fix default configuration values in tests
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -25,6 +25,7 @@ share/python-wheels/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
uv.lock
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
|
||||
5
CLAUDE.md
Normal file
5
CLAUDE.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Claude Code Instructions
|
||||
|
||||
Refer to @AGENTS.md for coding instructions.
|
||||
|
||||
DO NOT MODIFY "CLAUDE.md", UPDATE "AGENTS.md".
|
||||
@@ -77,7 +77,7 @@ async def get_stats(
|
||||
)
|
||||
|
||||
|
||||
@router.get("/dashboard", response_class=HTMLResponse)
|
||||
@router.get("/", response_class=HTMLResponse)
|
||||
async def dashboard(
|
||||
request: Request,
|
||||
session: DbSession,
|
||||
|
||||
@@ -30,11 +30,11 @@ class TestDashboardStats:
|
||||
|
||||
|
||||
class TestDashboardHtml:
|
||||
"""Tests for GET /dashboard/dashboard endpoint."""
|
||||
"""Tests for GET /dashboard endpoint."""
|
||||
|
||||
def test_dashboard_html_response(self, client_no_auth):
|
||||
"""Test dashboard returns HTML."""
|
||||
response = client_no_auth.get("/api/v1/dashboard/dashboard")
|
||||
response = client_no_auth.get("/api/v1/dashboard")
|
||||
assert response.status_code == 200
|
||||
assert "text/html" in response.headers["content-type"]
|
||||
assert "<!DOCTYPE html>" in response.text
|
||||
@@ -44,7 +44,7 @@ class TestDashboardHtml:
|
||||
self, client_no_auth, sample_node, sample_message
|
||||
):
|
||||
"""Test dashboard HTML contains stat values."""
|
||||
response = client_no_auth.get("/api/v1/dashboard/dashboard")
|
||||
response = client_no_auth.get("/api/v1/dashboard")
|
||||
assert response.status_code == 200
|
||||
# Check that stats are present
|
||||
assert "Total Nodes" in response.text
|
||||
@@ -53,7 +53,7 @@ class TestDashboardHtml:
|
||||
|
||||
def test_dashboard_contains_recent_data(self, client_no_auth, sample_node):
|
||||
"""Test dashboard HTML contains recent nodes."""
|
||||
response = client_no_auth.get("/api/v1/dashboard/dashboard")
|
||||
response = client_no_auth.get("/api/v1/dashboard")
|
||||
assert response.status_code == 200
|
||||
assert "Recent Nodes" in response.text
|
||||
# The node name should appear in the table
|
||||
|
||||
@@ -17,8 +17,8 @@ class TestCommonSettings:
|
||||
"""Tests for CommonSettings."""
|
||||
|
||||
def test_default_values(self) -> None:
|
||||
"""Test default setting values."""
|
||||
settings = CommonSettings()
|
||||
"""Test default setting values without .env file influence."""
|
||||
settings = CommonSettings(_env_file=None)
|
||||
|
||||
assert settings.log_level == LogLevel.INFO
|
||||
assert settings.mqtt_host == "localhost"
|
||||
@@ -32,8 +32,8 @@ class TestInterfaceSettings:
|
||||
"""Tests for InterfaceSettings."""
|
||||
|
||||
def test_default_values(self) -> None:
|
||||
"""Test default setting values."""
|
||||
settings = InterfaceSettings()
|
||||
"""Test default setting values without .env file influence."""
|
||||
settings = InterfaceSettings(_env_file=None)
|
||||
|
||||
assert settings.interface_mode == InterfaceMode.RECEIVER
|
||||
assert settings.serial_port == "/dev/ttyUSB0"
|
||||
@@ -45,23 +45,23 @@ class TestCollectorSettings:
|
||||
"""Tests for CollectorSettings."""
|
||||
|
||||
def test_default_values(self) -> None:
|
||||
"""Test default setting values."""
|
||||
settings = CollectorSettings()
|
||||
"""Test default setting values without .env file influence."""
|
||||
settings = CollectorSettings(_env_file=None)
|
||||
|
||||
assert settings.database_url == "sqlite:///./meshcore.db"
|
||||
|
||||
def test_database_url_validation(self) -> None:
|
||||
"""Test database URL validation."""
|
||||
with pytest.raises(ValueError):
|
||||
CollectorSettings(database_url="")
|
||||
CollectorSettings(_env_file=None, database_url="")
|
||||
|
||||
|
||||
class TestAPISettings:
|
||||
"""Tests for APISettings."""
|
||||
|
||||
def test_default_values(self) -> None:
|
||||
"""Test default setting values."""
|
||||
settings = APISettings()
|
||||
"""Test default setting values without .env file influence."""
|
||||
settings = APISettings(_env_file=None)
|
||||
|
||||
assert settings.api_host == "0.0.0.0"
|
||||
assert settings.api_port == 8000
|
||||
@@ -74,8 +74,8 @@ class TestWebSettings:
|
||||
"""Tests for WebSettings."""
|
||||
|
||||
def test_default_values(self) -> None:
|
||||
"""Test default setting values."""
|
||||
settings = WebSettings()
|
||||
"""Test default setting values without .env file influence."""
|
||||
settings = WebSettings(_env_file=None)
|
||||
|
||||
assert settings.web_host == "0.0.0.0"
|
||||
assert settings.web_port == 8080
|
||||
|
||||
Reference in New Issue
Block a user