fix: use config models when empty models list provided

When the trigger simulation API receives an empty models list ([]),
it now correctly falls back to enabled models from config instead
of running with no models.

Changes:
- Update condition to check for both None and empty list
- Add test case for empty models list behavior
- Update API documentation to clarify this behavior

All 28 integration tests pass.
This commit is contained in:
2025-11-02 09:07:58 -05:00
parent 34d3317571
commit aa4958bd9c
3 changed files with 15 additions and 3 deletions

View File

@@ -119,6 +119,18 @@ class TestSimulateTriggerEndpoint:
data = response.json()
assert data["total_model_days"] >= 1
def test_trigger_empty_models_uses_config(self, api_client):
"""Should use enabled models from config when models is empty list."""
response = api_client.post("/simulate/trigger", json={
"start_date": "2025-01-16",
"end_date": "2025-01-16",
"models": [] # Empty list - should use enabled models from config
})
assert response.status_code == 200
data = response.json()
assert data["total_model_days"] >= 1
def test_trigger_enforces_single_job_limit(self, api_client):
"""Should reject trigger when job already running."""
# Create first job