fix: correct JSON key from backup_name to name in config backup tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-26 17:45:55 +02:00
parent c6f01ca985
commit ae368a0d8e
2 changed files with 12 additions and 15 deletions

View File

@@ -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`

View File

@@ -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