Private
Public Access
0
0
Files
manual_slop/tests/test_gui_paths.py
T
ed 63e91198ac test(sandbox): update v3 paths-aware tests for FR1+FR3 invariants
- test_paths.py: explicit initialize_paths(<empty_config>) instead of
  SLOP_CONFIG env var (v3 design); add restore_paths fixture so other
  tests keep their conftest workspace init.
- test_summary_cache.py: use tmp_path (under ./tests/) instead of
  hardcoded Path('.test_cache') that FR1 blocks.
- test_orchestrator_pm_history.py: use tempfile.mkdtemp() instead of
  writing to project-root 'test_conductor/' that FR1 blocks.
- test_gui_paths.py::test_save_paths: mock src.paths.initialize_paths
  instead of src.paths.reset_paths (v3 entry point).

All 12 tests pass in the Tier 2 clone after these fixes.
2026-06-19 12:36:21 -04:00

44 lines
1.3 KiB
Python

import pytest
from unittest.mock import MagicMock, patch
from src import paths
# We mock App to avoid the heavy initialization logic
class MockApp:
def __init__(self):
self.ui_conductor_dir = '/mock/conductor'
self.ui_logs_dir = '/mock/logs'
self.ui_scripts_dir = '/mock/scripts'
self.config = {"paths": {}}
self.ai_status = ""
self.save_config = MagicMock()
def init_state(self):
"""
[C: tests/test_system_prompt_exposure.py:TestSystemPromptExposure.test_app_controller_init_state_loads_prompts]
"""
pass
from src.gui_2 import App
_save_paths = App._save_paths
def test_save_paths():
mock_app = MockApp()
with patch('shutil.copy') as mock_copy, \
patch('src.paths.get_config_path') as mock_get_cfg, \
patch('src.paths.initialize_paths') as mock_init_paths, \
patch.object(MockApp, 'init_state') as mock_init:
mock_get_cfg.return_value = MagicMock()
mock_get_cfg.return_value.exists.return_value = True
mock_app.ui_conductor_dir = '/new/conductor'
mock_app._save_paths()
# Verify config update
assert 'conductor_dir' not in mock_app.config['paths']
mock_app.save_config.assert_called_once()
mock_copy.assert_called_once()
assert 'applied' in mock_app.ai_status
mock_init_paths.assert_called_once()
mock_init.assert_called_once()