| 1851 | # max_iterations is optional (defaults to 10) |
| 1852 | |
| 1853 | def test_validate_invalid_max_iterations(self): |
| 1854 | from specify_cli.workflows.steps.while_loop import WhileStep |
| 1855 | |
| 1856 | step = WhileStep() |
| 1857 | errors = step.validate({"id": "test", "condition": "{{ true }}", "max_iterations": 0, "steps": []}) |
| 1858 | assert any("must be an integer >= 1" in e for e in errors) |
| 1859 | # bool is an int subclass; `max_iterations: true` must be rejected, not |
| 1860 | # silently treated as a single iteration. |
| 1861 | bool_errors = step.validate( |
| 1862 | {"id": "test", "condition": "{{ true }}", "max_iterations": True, "steps": []} |
| 1863 | ) |
| 1864 | assert any("must be an integer >= 1" in e for e in bool_errors) |
| 1865 | |
| 1866 | |
| 1867 | class TestDoWhileStep: |