conductor(checkpoint): Phase 4: Execution and Modals Simulation complete
This commit is contained in:
52
tests/test_sim_execution.py
Normal file
52
tests/test_sim_execution.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Ensure project root is in path
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
from simulation.sim_execution import ExecutionSimulation
|
||||
|
||||
def test_execution_simulation_run():
|
||||
mock_client = MagicMock()
|
||||
mock_client.wait_for_server.return_value = True
|
||||
|
||||
# Mock show_confirm_modal state
|
||||
vals = {"show_confirm_modal": False}
|
||||
def side_effect(key):
|
||||
return vals.get(key)
|
||||
def set_side_effect(key, val):
|
||||
vals[key] = val
|
||||
|
||||
mock_client.get_value.side_effect = side_effect
|
||||
mock_client.set_value.side_effect = set_side_effect
|
||||
|
||||
# Mock session entries with tool output
|
||||
mock_session = {
|
||||
'session': {
|
||||
'entries': [
|
||||
{'role': 'Tool', 'content': 'Simulation Test', 'tool_call_id': 'call_1'}
|
||||
]
|
||||
}
|
||||
}
|
||||
mock_client.get_session.return_value = mock_session
|
||||
|
||||
with patch('simulation.sim_base.WorkflowSimulator') as mock_sim_class:
|
||||
mock_sim = MagicMock()
|
||||
mock_sim_class.return_value = mock_sim
|
||||
|
||||
# We need a way to trigger show_confirm_modal = True
|
||||
# In sim_execution.py, it's called after run_discussion_turn
|
||||
# I'll mock run_discussion_turn to set it
|
||||
def run_side_effect(msg):
|
||||
vals["show_confirm_modal"] = True
|
||||
|
||||
mock_sim.run_discussion_turn.side_effect = run_side_effect
|
||||
|
||||
sim = ExecutionSimulation(mock_client)
|
||||
sim.run()
|
||||
|
||||
# Verify calls
|
||||
mock_sim.run_discussion_turn.assert_called()
|
||||
mock_client.click.assert_called_with("btn_approve_script")
|
||||
Reference in New Issue
Block a user