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.reset_resolved') as mock_reset, \
      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_reset.assert_called_once()
  mock_init.assert_called_once()