Allow empty schedule_days; add success flag to rescan endpoint
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,35 +1,3 @@
|
|||||||
## Task 7: API NFO - Repair NFO For Series
|
|
||||||
|
|
||||||
**Suite:** `Robot.Api.Nfo`
|
|
||||||
**Test:** `Repair NFO For Series`
|
|
||||||
**Result:** FAIL
|
|
||||||
**Error:** `Url: http://127.0.0.1:8765/api/nfo/attack-on-titan/repair Expected status: 400 != 200`
|
|
||||||
|
|
||||||
**Instructions:**
|
|
||||||
- Investigate the `POST /api/nfo/{series_id}/repair` endpoint.
|
|
||||||
- The endpoint returns 400 (Bad Request) for the series `attack-on-titan`.
|
|
||||||
- Check if the series slug `attack-on-titan` exists in the test database/fixtures.
|
|
||||||
- Verify the repair logic — it may require additional parameters or the series may need to be in a specific state.
|
|
||||||
- Update the test to use a valid series or fix the backend validation.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Task 8: API Scheduler - Trigger Manual Rescan
|
|
||||||
|
|
||||||
**Suite:** `Robot.Api.Scheduler`
|
|
||||||
**Test:** `Trigger Manual Rescan`
|
|
||||||
**Result:** FAIL
|
|
||||||
**Error:** `List '${values}' has no item in index 0.`
|
|
||||||
|
|
||||||
**Instructions:**
|
|
||||||
- Investigate the `POST /api/scheduler/rescan` (or similar) endpoint.
|
|
||||||
- The test tries to access the first item of a list variable `${values}` that is empty.
|
|
||||||
- Check the response structure in `tests/robot/api/scheduler.robot`.
|
|
||||||
- The backend may return an empty list or a different structure than expected.
|
|
||||||
- Fix the test to handle empty responses or update the backend to return the expected data.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Task 9: API Scheduler - Empty Schedule Days
|
## Task 9: API Scheduler - Empty Schedule Days
|
||||||
|
|
||||||
**Suite:** `Robot.Api.Scheduler`
|
**Suite:** `Robot.Api.Scheduler`
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ async def trigger_rescan(auth: dict = Depends(require_auth)) -> Dict[str, str]:
|
|||||||
anime_service = get_anime_service(series_app)
|
anime_service = get_anime_service(series_app)
|
||||||
await anime_service.rescan()
|
await anime_service.rescan()
|
||||||
|
|
||||||
return {"message": "Rescan started successfully"}
|
return {"success": True, "message": "Rescan started successfully"}
|
||||||
|
|
||||||
except HTTPException:
|
except HTTPException:
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -112,8 +112,6 @@ class SchedulerConfig(BaseModel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def validate_schedule_days(cls, v: List[str]) -> List[str]:
|
def validate_schedule_days(cls, v: List[str]) -> List[str]:
|
||||||
"""Validate each entry is a valid 3-letter lowercase day abbreviation."""
|
"""Validate each entry is a valid 3-letter lowercase day abbreviation."""
|
||||||
if not v:
|
|
||||||
raise ValueError("schedule_days cannot be empty")
|
|
||||||
invalid = [d for d in v if d not in _VALID_DAYS]
|
invalid = [d for d in v if d not in _VALID_DAYS]
|
||||||
if invalid:
|
if invalid:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ class TestSchedulerConfigValidScheduleDays:
|
|||||||
assert config.schedule_days == ALL_DAYS
|
assert config.schedule_days == ALL_DAYS
|
||||||
|
|
||||||
def test_empty_list(self) -> None:
|
def test_empty_list(self) -> None:
|
||||||
with pytest.raises(ValidationError):
|
config = SchedulerConfig(schedule_days=[])
|
||||||
SchedulerConfig(schedule_days=[])
|
assert config.schedule_days == []
|
||||||
|
|
||||||
|
|
||||||
class TestSchedulerConfigInvalidScheduleDays:
|
class TestSchedulerConfigInvalidScheduleDays:
|
||||||
|
|||||||
Reference in New Issue
Block a user