ok
This commit is contained in:
@@ -5,39 +5,23 @@ from unittest.mock import patch
|
||||
|
||||
|
||||
def test_track_proposal_editing(app_instance):
|
||||
# Setup some proposed tracks
|
||||
app_instance.proposed_tracks = [
|
||||
{"title": "Old Title", "goal": "Old Goal"},
|
||||
{"title": "Another Track", "goal": "Another Goal"}
|
||||
]
|
||||
|
||||
# Simulate editing via logic (since we can't easily drive imgui in unit tests)
|
||||
# The tool instructions say to verify "track proposal editing"
|
||||
app_instance.proposed_tracks[0]['title'] = "New Title"
|
||||
app_instance.proposed_tracks[0]['goal'] = "New Goal"
|
||||
|
||||
assert app_instance.proposed_tracks[0]['title'] == "New Title"
|
||||
assert app_instance.proposed_tracks[0]['goal'] == "New Goal"
|
||||
|
||||
# Test removal logic
|
||||
app_instance.proposed_tracks.pop(1)
|
||||
assert len(app_instance.proposed_tracks) == 1
|
||||
assert app_instance.proposed_tracks[0]['title'] == "New Title"
|
||||
|
||||
def test_conductor_setup_scan(app_instance, tmp_path):
|
||||
# Create a mock conductor directory
|
||||
cond_dir = tmp_path / "conductor"
|
||||
cond_dir.mkdir()
|
||||
(cond_dir / "index.md").write_text("Index content\nLine 2")
|
||||
(cond_dir / "tracks").mkdir()
|
||||
(cond_dir / "tracks" / "track1").mkdir()
|
||||
|
||||
with patch('gui_2.Path', side_effect=lambda *args: Path(tmp_path, *args) if args and args[0] == "conductor" else Path(*args)):
|
||||
# We need to be careful with Path mocking.
|
||||
# Instead of mocking Path globally, let's just use a real dir if possible or mock the method's behavior.
|
||||
pass
|
||||
|
||||
# Alternative: Change CWD for the test
|
||||
def test_conductor_setup_scan(app_instance, tmp_path):
|
||||
old_cwd = os.getcwd()
|
||||
os.chdir(tmp_path)
|
||||
try:
|
||||
@@ -55,16 +39,16 @@ def test_conductor_setup_scan(app_instance, tmp_path):
|
||||
finally:
|
||||
os.chdir(old_cwd)
|
||||
|
||||
|
||||
def test_create_track(app_instance, tmp_path):
|
||||
old_cwd = os.getcwd()
|
||||
os.chdir(tmp_path)
|
||||
try:
|
||||
(Path("conductor") / "tracks").mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with patch('gui_2.project_manager.get_all_tracks', return_value=[]):
|
||||
with patch('src.gui_2.project_manager.get_all_tracks', return_value=[]):
|
||||
app_instance._cb_create_track("Test Track", "Test Description", "feature")
|
||||
|
||||
# Search for a directory starting with 'test_track' in 'conductor/tracks/'
|
||||
tracks_root = Path("conductor/tracks")
|
||||
matching_dirs = [d for d in tracks_root.iterdir() if d.is_dir() and d.name.startswith("test_track")]
|
||||
assert len(matching_dirs) == 1
|
||||
|
||||
Reference in New Issue
Block a user