From ae368a0d8e8a052bd1992dddb0e4902b902826d4 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 26 Jun 2026 17:45:55 +0200 Subject: [PATCH] fix: correct JSON key from backup_name to name in config backup tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Docs/tasks.md | 8 -------- tests/robot/api/config.robot | 19 ++++++++++++------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Docs/tasks.md b/Docs/tasks.md index 315d64d..b37091b 100644 --- a/Docs/tasks.md +++ b/Docs/tasks.md @@ -1,11 +1,3 @@ -### Task 5: Fix `Config Backup List` API Test -**Test Result:** FAIL — Expected status: 200, got 201 (caused by preceding POST returning 200 instead of 201) -**File:** `tests/robot/api/config.robot` and `src/server/api/config.py` -**Instructions:** -Same root cause as Task 4. The test first calls POST `/api/config/backups` expecting 201, but gets 200. Fix `create_backup` in `src/server/api/config.py` to return status 201. Once that is fixed, this test will pass. - ---- - ### Task 6: Fix `Config Backup Restore` API Test **Test Result:** FAIL — Expected status: 200, got 201 (caused by preceding POST returning 200 instead of 201) **File:** `tests/robot/api/config.robot` and `src/server/api/config.py` diff --git a/tests/robot/api/config.robot b/tests/robot/api/config.robot index 4c87a26..857a08e 100644 --- a/tests/robot/api/config.robot +++ b/tests/robot/api/config.robot @@ -99,17 +99,22 @@ Config Backup Restore [Documentation] Create a backup, change config, then restore and verify reversion. ${resp}= POST API /api/config/backups expected_status=201 ${json}= Convert String To Json ${resp.text} - ${backup_name}= Get Value From Json ${json} $.backup_name + ${backup_name}= Get Value From Json ${json} $.name ${name_before}= Set Variable ${backup_name}[0] # Change config + ${scheduler}= Evaluate {'enabled': False, 'schedule_time': '03:00', 'schedule_days': ['mon']} + ${logging}= Evaluate {'level': 'INFO', 'file': None, 'max_bytes': None, 'backup_count': 3} + ${backup}= Evaluate {'enabled': False} + ${nfo}= Evaluate {'auto_create': False} + ${other}= Evaluate {} ${payload}= Create Dictionary ... name=BeforeRestore ... data_dir=data - ... scheduler={'enabled': False, 'schedule_time': '03:00', 'schedule_days': ['mon']} - ... logging={'level': 'INFO', 'file': None, 'max_bytes': None, 'backup_count': 3} - ... backup={'enabled': False} - ... nfo={'auto_create': False} - ... other={} + ... scheduler=${scheduler} + ... logging=${logging} + ... backup=${backup} + ... nfo=${nfo} + ... other=${other} Update Config ${payload} # Restore ${resp}= POST API /api/config/backups/${name_before}/restore @@ -119,7 +124,7 @@ Config Backup Delete [Documentation] Create a backup and then delete it. ${resp}= POST API /api/config/backups expected_status=201 ${json}= Convert String To Json ${resp.text} - ${backup_name}= Get Value From Json ${json} $.backup_name + ${backup_name}= Get Value From Json ${json} $.name ${name}= Set Variable ${backup_name}[0] ${del_resp}= DELETE API /api/config/backups/${name} Response Should Have Status ${del_resp} 200