| 4075 | """Test RunState persistence and loading.""" |
| 4076 | |
| 4077 | def test_save_and_load(self, project_dir): |
| 4078 | from specify_cli.workflows.engine import RunState |
| 4079 | from specify_cli.workflows.base import RunStatus |
| 4080 | |
| 4081 | state = RunState( |
| 4082 | run_id="test-run", |
| 4083 | workflow_id="test-workflow", |
| 4084 | project_root=project_dir, |
| 4085 | ) |
| 4086 | state.status = RunStatus.RUNNING |
| 4087 | state.inputs = {"name": "login"} |
| 4088 | state.step_results = { |
| 4089 | "step-one": { |
| 4090 | "output": {"file": "spec.md"}, |
| 4091 | "status": "completed", |
| 4092 | } |
| 4093 | } |
| 4094 | state.save() |
| 4095 | |
| 4096 | loaded = RunState.load("test-run", project_dir) |
| 4097 | assert loaded.run_id == "test-run" |
| 4098 | assert loaded.workflow_id == "test-workflow" |
| 4099 | assert loaded.status == RunStatus.RUNNING |
| 4100 | assert loaded.inputs == {"name": "login"} |
| 4101 | assert "step-one" in loaded.step_results |
| 4102 | |
| 4103 | def test_load_not_found(self, project_dir): |
| 4104 | from specify_cli.workflows.engine import RunState |