mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 12:26:19 -05:00
Creating Controller service which will control WROLPi services, admin, SMART, disks, and status. nginx will fallback to Controller UI when React UI is unavailable (such as during upgrades).
This commit is contained in:
parent
344fe9035f
commit
b9158b60fe
66 changed files with 9920 additions and 327 deletions
50
controller/test/test_schemas.py
Normal file
50
controller/test/test_schemas.py
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
"""
|
||||
Unit tests for controller.api.schemas module.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from controller.api.schemas import HealthResponse
|
||||
|
||||
|
||||
class TestHealthResponse:
|
||||
"""Tests for HealthResponse model."""
|
||||
|
||||
def test_valid_health_response(self):
|
||||
"""Should create valid health response."""
|
||||
response = HealthResponse(
|
||||
status="healthy",
|
||||
version="1.0.0",
|
||||
docker_mode=False,
|
||||
drive_mounted=True,
|
||||
)
|
||||
assert response.status == "healthy"
|
||||
assert response.version == "1.0.0"
|
||||
assert response.docker_mode is False
|
||||
assert response.drive_mounted is True
|
||||
|
||||
def test_health_response_serialization(self):
|
||||
"""Should serialize to dict correctly."""
|
||||
response = HealthResponse(
|
||||
status="healthy",
|
||||
version="1.0.0",
|
||||
docker_mode=True,
|
||||
drive_mounted=False,
|
||||
)
|
||||
data = response.model_dump()
|
||||
assert data == {
|
||||
"status": "healthy",
|
||||
"version": "1.0.0",
|
||||
"docker_mode": True,
|
||||
"drive_mounted": False,
|
||||
}
|
||||
|
||||
def test_health_response_missing_field(self):
|
||||
"""Should raise validation error for missing required field."""
|
||||
with pytest.raises(ValidationError):
|
||||
HealthResponse(
|
||||
status="healthy",
|
||||
version="1.0.0",
|
||||
# missing docker_mode and drive_mounted
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue