Add NFO scan endpoint and fix scheduler test payload
- Implement /api/nfo/scan endpoint returning scan results - Fix Robot Framework scheduler test: use Evaluate+json.loads instead of Create Dictionary for nested data - Remove completed task docs
This commit is contained in:
@@ -1,21 +1,3 @@
|
|||||||
## Task 10: Repair NFO For Series — Should accept repair request
|
|
||||||
|
|
||||||
**Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/nfo/attack-on-titan/repair Expected status: 400 != 200`
|
|
||||||
|
|
||||||
**Instructions:**
|
|
||||||
The `Repair NFO For Series` API test expects a `200 OK` from `/api/nfo/{series}/repair`, but gets `400 Bad Request`. Review the endpoint. The request may be missing required fields, or the series identifier may not be found. Ensure the endpoint accepts a valid series name and triggers NFO repair, returning 200 on success.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Task 11: Run NFO Scan — Endpoint should exist
|
|
||||||
|
|
||||||
**Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/nfo/scan Expected status: 404 != 200`
|
|
||||||
|
|
||||||
**Instructions:**
|
|
||||||
The `Run NFO Scan` API test expects a `200 OK` from `/api/nfo/scan`, but gets `404 Not Found`. The endpoint does not exist or the route is incorrect. Implement or fix the route so it triggers an NFO scan across all series and returns 200.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Task 12: Update Scheduler Config — Should accept valid scheduler updates
|
## Task 12: Update Scheduler Config — Should accept valid scheduler updates
|
||||||
|
|
||||||
**Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/scheduler/config Expected status: 422 != 200`
|
**Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/scheduler/config Expected status: 422 != 200`
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ from src.server.models.nfo import (
|
|||||||
NfoSettingsResponse,
|
NfoSettingsResponse,
|
||||||
)
|
)
|
||||||
from src.server.services.anime_service import AnimeService
|
from src.server.services.anime_service import AnimeService
|
||||||
|
from src.server.services.nfo_scan_service import get_nfo_scan_service
|
||||||
from src.server.utils.dependencies import get_anime_service, require_auth
|
from src.server.utils.dependencies import get_anime_service, require_auth
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -531,3 +532,36 @@ async def batch_repair_nfo(
|
|||||||
results["errors"].append(f"{key}: {str(exc)}")
|
results["errors"].append(f"{key}: {str(exc)}")
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
class NfoScanResponse(BaseModel):
|
||||||
|
"""Response for the NFO scan endpoint."""
|
||||||
|
|
||||||
|
total: int
|
||||||
|
created: int
|
||||||
|
updated: int
|
||||||
|
errors_count: int
|
||||||
|
scan_id: str
|
||||||
|
duration_seconds: float
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/scan", response_model=NfoScanResponse)
|
||||||
|
async def scan_nfo(
|
||||||
|
_auth: dict = Depends(require_auth),
|
||||||
|
anime_service: AnimeService = Depends(get_anime_service),
|
||||||
|
) -> NfoScanResponse:
|
||||||
|
"""Run an NFO scan across all series.
|
||||||
|
|
||||||
|
Triggers validation and creation of tvshow.nfo files for all series
|
||||||
|
in the anime library.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
_auth: Authentication dependency
|
||||||
|
anime_service: AnimeService dependency
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
NfoScanResponse with summary of scan results
|
||||||
|
"""
|
||||||
|
nfo_scan_service = get_nfo_scan_service()
|
||||||
|
result = await nfo_scan_service.scan_all(anime_service)
|
||||||
|
return NfoScanResponse(**result)
|
||||||
|
|||||||
@@ -32,12 +32,7 @@ Get Scheduler Config
|
|||||||
|
|
||||||
Update Scheduler Config
|
Update Scheduler Config
|
||||||
[Documentation] Update scheduler settings and verify they are persisted.
|
[Documentation] Update scheduler settings and verify they are persisted.
|
||||||
${payload}= Create Dictionary
|
${payload}= Evaluate json.loads('''{"enabled": true, "interval_minutes": 120, "schedule_time": "04:30", "schedule_days": ["mon", "wed", "fri"], "auto_download_after_rescan": true}''') modules=json
|
||||||
... enabled=True
|
|
||||||
... interval_minutes=120
|
|
||||||
... schedule_time=04:30
|
|
||||||
... schedule_days=['mon', 'wed', 'fri']
|
|
||||||
... auto_download_after_rescan=True
|
|
||||||
${resp}= Update Scheduler Config ${payload}
|
${resp}= Update Scheduler Config ${payload}
|
||||||
Response Should Have Status ${resp} 200
|
Response Should Have Status ${resp} 200
|
||||||
${saved_time}= Get JSON Value ${resp} $.config.schedule_time
|
${saved_time}= Get JSON Value ${resp} $.config.schedule_time
|
||||||
|
|||||||
Reference in New Issue
Block a user