reject empty schedule_days with 422

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-27 17:09:11 +02:00
parent e5a5a6009a
commit 2e723087d9
5 changed files with 19 additions and 52 deletions

View File

@@ -252,18 +252,17 @@ class TestUpdateSchedulerConfig:
assert response.status_code == 422
@pytest.mark.asyncio
async def test_empty_schedule_days_accepted(
async def test_empty_schedule_days_rejected(
self, authenticated_client, mock_config_service, mock_scheduler_service
):
"""Empty schedule_days list is valid (disables the cron job)."""
"""Empty schedule_days list is invalid and returns 422."""
payload = {"enabled": True, "schedule_days": []}
with patch("src.server.api.scheduler.get_config_service", return_value=mock_config_service), \
patch("src.server.api.scheduler.get_scheduler_service", return_value=mock_scheduler_service):
response = await authenticated_client.post("/api/scheduler/config", json=payload)
assert response.status_code == 200
assert response.json()["config"]["schedule_days"] == []
assert response.status_code == 422
@pytest.mark.asyncio
async def test_update_enable_disable_toggle(