Files
manual_slop/tests/test_layout_reorganization.py

66 lines
2.2 KiB
Python

import pytest
from typing import Any
import sys
import os
# Ensure project root is in path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")))
from gui_2 import App
def test_new_hubs_defined_in_show_windows(mock_app: App) -> None:
"""
Verifies that the new consolidated Hub windows are defined in the App's show_windows.
This ensures they will be available in the 'Windows' menu.
"""
expected_hubs = [
"Context Hub",
"AI Settings",
"Discussion Hub",
"Operations Hub",
]
for hub in expected_hubs:
assert hub in mock_app.show_windows, f"Expected window {hub} not found in show_windows"
def test_old_windows_removed_from_gui2(app_instance_simple: Any) -> None:
"""
Verifies that the old fragmented windows are removed or renamed.
"""
old_tags = [
"win_projects", "win_files", "win_screenshots",
"win_provider", "win_system_prompts",
"win_discussion", "win_message", "win_response",
"win_comms", "win_tool_log"
]
for tag in old_tags:
# gui_2 doesn't use these tags at all in show_windows
assert tag not in app_instance_simple.show_windows, f"Old window tag {tag} should not be in show_windows"
@pytest.fixture
def app_instance_simple() -> Any:
from unittest.mock import patch
from gui_2 import App
with patch('src.models.load_config', return_value={'ai': {}, 'projects': {}, 'gui': {'show_windows': {}}}), \
patch('src.app_controller.AppController._init_ai_and_hooks'), \
patch('src.app_controller.AppController._fetch_models'), \
patch('src.app_controller.AppController._prune_old_logs'), \
patch('src.app_controller.AppController.start_services'):
app = App()
return app
def test_hub_windows_exist_in_gui2(app_instance_simple: Any) -> None:
"""
Verifies that the new Hub windows are present in the show_windows dictionary.
"""
hubs = ["Context Hub", "AI Settings", "Discussion Hub", "Operations Hub"]
for hub in hubs:
assert hub in app_instance_simple.show_windows
def test_indicators_logic_exists(app_instance_simple: Any) -> None:
"""
Verifies that the status indicators logic exists in the App.
"""
assert hasattr(app_instance_simple, 'ai_status')
assert hasattr(app_instance_simple, 'mma_status')