Added unit tests for route API and route handling infrastructure.
CI / Formatting (push) Successful in 4s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 19s
CI / Tests (Python 3.13) (push) Successful in 19s
CI / Tests (Python 3.14) (push) Successful in 26s
CI / Type Checking (push) Failing after 32s
CI / Spelling (push) Successful in 29s

This commit is contained in:
2026-03-26 17:18:00 -04:00
parent 20272fedfd
commit 4ff35fdf6b
4 changed files with 994 additions and 66 deletions
+19
View File
@@ -20,6 +20,7 @@ from typing import TYPE_CHECKING
import pytest
from owlbot.api.context import ModuleContext
from owlbot.api.storage import ModuleStorage
if TYPE_CHECKING:
@@ -27,6 +28,24 @@ if TYPE_CHECKING:
from pathlib import Path
def make_module_context(
storage: ModuleStorage | None = None, module_name: str = "mod_a"
) -> ModuleContext:
"""Build a stub ModuleContext backed by real or None storage."""
return ModuleContext(
module_name=module_name,
config=None, # type: ignore[arg-type]
owncast_client=None, # type: ignore[arg-type]
storage=storage, # type: ignore[arg-type]
commands=None, # type: ignore[arg-type]
events=None, # type: ignore[arg-type]
routes=None, # type: ignore[arg-type]
http=None, # type: ignore[arg-type]
templates=None, # type: ignore[arg-type]
admin_client=None,
)
@pytest.fixture
async def storage(tmp_path: Path) -> AsyncIterator[ModuleStorage]:
"""Yield an open ModuleStorage backed by a temporary directory."""