feat: add slug-only dashboard profile filter and unify backend imports
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
from types import SimpleNamespace
|
||||
import json
|
||||
|
||||
from backend.src.dependencies import get_clean_release_repository, get_config_manager
|
||||
from src.dependencies import get_clean_release_repository, get_config_manager
|
||||
from datetime import datetime, timezone
|
||||
from uuid import uuid4
|
||||
|
||||
from backend.src.models.clean_release import CleanPolicySnapshot, ComplianceReport, ReleaseCandidate, SourceRegistrySnapshot
|
||||
from backend.src.services.clean_release.enums import CandidateStatus, ComplianceDecision
|
||||
from backend.src.scripts.clean_release_cli import main as cli_main
|
||||
from src.models.clean_release import CleanPolicySnapshot, ComplianceReport, ReleaseCandidate, SourceRegistrySnapshot
|
||||
from src.services.clean_release.enums import CandidateStatus, ComplianceDecision
|
||||
from src.scripts.clean_release_cli import main as cli_main
|
||||
|
||||
|
||||
def test_cli_candidate_register_scaffold() -> None:
|
||||
@@ -302,4 +302,4 @@ def test_cli_release_gate_commands_scaffold() -> None:
|
||||
assert revoke_exit == 0
|
||||
|
||||
|
||||
# [/DEF:test_clean_release_cli:Module]
|
||||
# [/DEF:test_clean_release_cli:Module]
|
||||
|
||||
@@ -14,8 +14,8 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from backend.src.scripts.clean_release_tui import CleanReleaseTUI, main, tui_main
|
||||
from backend.src.models.clean_release import CheckFinalStatus
|
||||
from src.scripts.clean_release_tui import CleanReleaseTUI, main, tui_main
|
||||
from src.models.clean_release import CheckFinalStatus
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -31,7 +31,7 @@ def test_headless_fallback(capsys):
|
||||
@TEST_EDGE: stdout_unavailable
|
||||
Tests that non-TTY startup is explicitly refused and wrapper is not invoked.
|
||||
"""
|
||||
with mock.patch("backend.src.scripts.clean_release_tui.curses.wrapper") as curses_wrapper_mock:
|
||||
with mock.patch("src.scripts.clean_release_tui.curses.wrapper") as curses_wrapper_mock:
|
||||
with mock.patch("sys.stdout.isatty", return_value=False):
|
||||
exit_code = main()
|
||||
|
||||
@@ -43,7 +43,7 @@ def test_headless_fallback(capsys):
|
||||
assert "Use CLI/API workflow instead" in captured.err
|
||||
|
||||
|
||||
@patch("backend.src.scripts.clean_release_tui.curses")
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
def test_tui_initial_render(mock_curses_module, mock_stdscr: MagicMock):
|
||||
"""
|
||||
Simulates the initial rendering cycle of the TUI application to ensure
|
||||
@@ -76,7 +76,7 @@ def test_tui_initial_render(mock_curses_module, mock_stdscr: MagicMock):
|
||||
assert any("F5 Run" in str(call) for call in addstr_calls)
|
||||
|
||||
|
||||
@patch("backend.src.scripts.clean_release_tui.curses")
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
def test_tui_run_checks_f5(mock_curses_module, mock_stdscr: MagicMock):
|
||||
"""
|
||||
Simulates pressing F5 to transition into the RUNNING checks flow.
|
||||
@@ -111,7 +111,7 @@ def test_tui_run_checks_f5(mock_curses_module, mock_stdscr: MagicMock):
|
||||
assert len(app.violations_list) > 0
|
||||
|
||||
|
||||
@patch("backend.src.scripts.clean_release_tui.curses")
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
def test_tui_exit_f10(mock_curses_module, mock_stdscr: MagicMock):
|
||||
"""
|
||||
Simulates pressing F10 to exit the application immediately without running checks.
|
||||
@@ -128,7 +128,7 @@ def test_tui_exit_f10(mock_curses_module, mock_stdscr: MagicMock):
|
||||
assert app.status == "READY"
|
||||
|
||||
|
||||
@patch("backend.src.scripts.clean_release_tui.curses")
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
def test_tui_clear_history_f7(mock_curses_module, mock_stdscr: MagicMock):
|
||||
"""
|
||||
Simulates pressing F7 to clear history.
|
||||
@@ -153,4 +153,3 @@ def test_tui_clear_history_f7(mock_curses_module, mock_stdscr: MagicMock):
|
||||
|
||||
|
||||
# [/DEF:backend.tests.scripts.test_clean_release_tui:Module]
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ from __future__ import annotations
|
||||
import curses
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from backend.src.models.clean_release import CheckFinalStatus
|
||||
from backend.src.scripts.clean_release_tui import CleanReleaseTUI, main
|
||||
from src.models.clean_release import CheckFinalStatus
|
||||
from src.scripts.clean_release_tui import CleanReleaseTUI, main
|
||||
|
||||
|
||||
def _build_mock_stdscr() -> MagicMock:
|
||||
@@ -22,7 +22,7 @@ def _build_mock_stdscr() -> MagicMock:
|
||||
return stdscr
|
||||
|
||||
|
||||
@patch("backend.src.scripts.clean_release_tui.curses")
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
def test_tui_f5_dispatches_run_action(mock_curses_module: MagicMock) -> None:
|
||||
"""F5 should dispatch run action from TUI loop."""
|
||||
mock_curses_module.KEY_F10 = curses.KEY_F10
|
||||
@@ -40,7 +40,7 @@ def test_tui_f5_dispatches_run_action(mock_curses_module: MagicMock) -> None:
|
||||
run_checks_mock.assert_called_once_with()
|
||||
|
||||
|
||||
@patch("backend.src.scripts.clean_release_tui.curses")
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
def test_tui_f5_run_smoke_reports_blocked_state(mock_curses_module: MagicMock) -> None:
|
||||
"""F5 smoke test should expose blocked outcome state after run action."""
|
||||
mock_curses_module.KEY_F10 = curses.KEY_F10
|
||||
@@ -76,7 +76,7 @@ def test_tui_non_tty_refuses_startup(capsys) -> None:
|
||||
assert "Use CLI/API workflow instead" in captured.err
|
||||
|
||||
|
||||
@patch("backend.src.scripts.clean_release_tui.curses")
|
||||
@patch("src.scripts.clean_release_tui.curses")
|
||||
def test_tui_f8_blocked_without_facade_binding(mock_curses_module: MagicMock) -> None:
|
||||
"""F8 should not perform hidden state mutation when facade action is not bound."""
|
||||
mock_curses_module.KEY_F10 = curses.KEY_F10
|
||||
@@ -94,4 +94,4 @@ def test_tui_f8_blocked_without_facade_binding(mock_curses_module: MagicMock) ->
|
||||
assert "F8 disabled" in app.last_error
|
||||
|
||||
|
||||
# [/DEF:test_clean_release_tui_v2:Module]
|
||||
# [/DEF:test_clean_release_tui_v2:Module]
|
||||
|
||||
Reference in New Issue
Block a user