48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
import pytest
|
|
import sys
|
|
import os
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
# Ensure project root is in path
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
|
|
from simulation.workflow_sim import WorkflowSimulator
|
|
|
|
def test_simulator_instantiation():
|
|
client = MagicMock()
|
|
sim = WorkflowSimulator(client)
|
|
assert sim is not None
|
|
|
|
def test_setup_new_project():
|
|
client = MagicMock()
|
|
sim = WorkflowSimulator(client)
|
|
|
|
# Mock responses for wait_for_server
|
|
client.wait_for_server.return_value = True
|
|
|
|
sim.setup_new_project("TestProject", "/tmp/test_git")
|
|
|
|
# Verify hook calls
|
|
client.click.assert_any_call("btn_project_new")
|
|
client.set_value.assert_any_call("project_git_dir", "/tmp/test_git")
|
|
client.click.assert_any_call("btn_project_save")
|
|
|
|
def test_discussion_switching():
|
|
client = MagicMock()
|
|
sim = WorkflowSimulator(client)
|
|
|
|
sim.create_discussion("NewDisc")
|
|
client.set_value.assert_called_with("disc_new_name_input", "NewDisc")
|
|
client.click.assert_called_with("btn_disc_create")
|
|
|
|
sim.switch_discussion("NewDisc")
|
|
client.select_list_item.assert_called_with("disc_listbox", "NewDisc")
|
|
|
|
def test_history_truncation():
|
|
client = MagicMock()
|
|
sim = WorkflowSimulator(client)
|
|
|
|
sim.truncate_history(3)
|
|
client.set_value.assert_called_with("disc_truncate_pairs", 3)
|
|
client.click.assert_called_with("btn_disc_truncate")
|