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:
@@ -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
|
### 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)
|
**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`
|
**File:** `tests/robot/api/config.robot` and `src/server/api/config.py`
|
||||||
|
|||||||
@@ -99,17 +99,22 @@ Config Backup Restore
|
|||||||
[Documentation] Create a backup, change config, then restore and verify reversion.
|
[Documentation] Create a backup, change config, then restore and verify reversion.
|
||||||
${resp}= POST API /api/config/backups expected_status=201
|
${resp}= POST API /api/config/backups expected_status=201
|
||||||
${json}= Convert String To Json ${resp.text}
|
${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]
|
${name_before}= Set Variable ${backup_name}[0]
|
||||||
# Change config
|
# 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
|
${payload}= Create Dictionary
|
||||||
... name=BeforeRestore
|
... name=BeforeRestore
|
||||||
... data_dir=data
|
... data_dir=data
|
||||||
... scheduler={'enabled': False, 'schedule_time': '03:00', 'schedule_days': ['mon']}
|
... scheduler=${scheduler}
|
||||||
... logging={'level': 'INFO', 'file': None, 'max_bytes': None, 'backup_count': 3}
|
... logging=${logging}
|
||||||
... backup={'enabled': False}
|
... backup=${backup}
|
||||||
... nfo={'auto_create': False}
|
... nfo=${nfo}
|
||||||
... other={}
|
... other=${other}
|
||||||
Update Config ${payload}
|
Update Config ${payload}
|
||||||
# Restore
|
# Restore
|
||||||
${resp}= POST API /api/config/backups/${name_before}/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.
|
[Documentation] Create a backup and then delete it.
|
||||||
${resp}= POST API /api/config/backups expected_status=201
|
${resp}= POST API /api/config/backups expected_status=201
|
||||||
${json}= Convert String To Json ${resp.text}
|
${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]
|
${name}= Set Variable ${backup_name}[0]
|
||||||
${del_resp}= DELETE API /api/config/backups/${name}
|
${del_resp}= DELETE API /api/config/backups/${name}
|
||||||
Response Should Have Status ${del_resp} 200
|
Response Should Have Status ${del_resp} 200
|
||||||
|
|||||||
Reference in New Issue
Block a user