test(dashboard): cover constants, git helper, cron endpoint, files sandbox
This commit is contained in:
76
tests/test_dashboard_constants.py
Normal file
76
tests/test_dashboard_constants.py
Normal file
@@ -0,0 +1,76 @@
|
||||
"""Validate the dashboard `constants` module exposes the post-consolidation paths."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||
DASH = PROJECT_ROOT / "dashboard"
|
||||
|
||||
# Make dashboard/ importable (same trick api.py does at runtime)
|
||||
if str(DASH) not in sys.path:
|
||||
sys.path.insert(0, str(DASH))
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def constants():
|
||||
# Imported as a module, not via `from dashboard import constants`,
|
||||
# because handlers use bare `import constants`.
|
||||
import constants as _c # type: ignore
|
||||
return _c
|
||||
|
||||
|
||||
def test_base_dir_is_echo_core(constants):
|
||||
assert constants.BASE_DIR == PROJECT_ROOT
|
||||
assert constants.BASE_DIR.name == "echo-core"
|
||||
|
||||
|
||||
def test_echo_core_dir_equals_base_dir(constants):
|
||||
"""Post-consolidation: ECHO_CORE_DIR and BASE_DIR point at the same place."""
|
||||
assert constants.ECHO_CORE_DIR == constants.BASE_DIR
|
||||
|
||||
|
||||
def test_git_workspace_is_echo_core(constants):
|
||||
"""Legacy clawd workspace must be gone."""
|
||||
assert constants.GIT_WORKSPACE == constants.BASE_DIR
|
||||
assert "clawd" not in str(constants.GIT_WORKSPACE)
|
||||
|
||||
|
||||
def test_allowed_workspaces_do_not_include_clawd(constants):
|
||||
for w in constants.ALLOWED_WORKSPACES:
|
||||
assert "clawd" not in str(w), f"clawd leaked into ALLOWED_WORKSPACES: {w}"
|
||||
|
||||
|
||||
def test_allowed_workspaces_include_echo_core_and_workspace(constants):
|
||||
allowed = {str(p) for p in constants.ALLOWED_WORKSPACES}
|
||||
assert str(constants.BASE_DIR) in allowed
|
||||
assert str(constants.WORKSPACE_DIR) in allowed
|
||||
|
||||
|
||||
def test_venv_python_is_dot_venv(constants):
|
||||
"""The dashboard must spawn the .venv python (not legacy `venv/`)."""
|
||||
assert constants.VENV_PYTHON == constants.BASE_DIR / ".venv" / "bin" / "python3"
|
||||
assert ".venv" in str(constants.VENV_PYTHON)
|
||||
|
||||
|
||||
def test_notes_dir_points_at_in_repo_memory(constants):
|
||||
"""memory/ lives inside echo-core post-consolidation."""
|
||||
assert constants.NOTES_DIR == constants.BASE_DIR / "memory" / "kb" / "youtube"
|
||||
|
||||
|
||||
def test_eco_services_list(constants):
|
||||
assert "echo-core" in constants.ECO_SERVICES
|
||||
assert "echo-whatsapp-bridge" in constants.ECO_SERVICES
|
||||
assert "echo-taskboard" in constants.ECO_SERVICES
|
||||
|
||||
|
||||
def test_echo_log_and_sessions_paths(constants):
|
||||
assert constants.ECHO_LOG_FILE == constants.BASE_DIR / "logs" / "echo-core.log"
|
||||
assert constants.ECHO_SESSIONS_FILE == constants.BASE_DIR / "sessions" / "active.json"
|
||||
|
||||
|
||||
def test_habits_file_is_inside_dashboard(constants):
|
||||
assert constants.HABITS_FILE == constants.KANBAN_DIR / "habits.json"
|
||||
assert constants.KANBAN_DIR == constants.BASE_DIR / "dashboard"
|
||||
Reference in New Issue
Block a user