mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-11 18:39:30 +00:00
test(backup): total restore endpoint testing
This commit is contained in:
parent
2ee66d143c
commit
8e4e8c99b1
|
@ -55,7 +55,7 @@ mutation TestForcedAutobackup {
|
||||||
API_TOTAL_RESTORE = """
|
API_TOTAL_RESTORE = """
|
||||||
mutation TestTotalRestore {
|
mutation TestTotalRestore {
|
||||||
backup {
|
backup {
|
||||||
fullRestore{
|
restoreAll{
|
||||||
success
|
success
|
||||||
message
|
message
|
||||||
code
|
code
|
||||||
|
@ -323,6 +323,17 @@ def api_total_backup(authorized_client):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def api_restore_all(authorized_client):
|
||||||
|
response = authorized_client.post(
|
||||||
|
"/graphql",
|
||||||
|
json={
|
||||||
|
"query": API_TOTAL_RESTORE,
|
||||||
|
"variables": {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
def api_init(
|
def api_init(
|
||||||
authorized_client,
|
authorized_client,
|
||||||
kind,
|
kind,
|
||||||
|
@ -700,3 +711,32 @@ def test_last_slice(authorized_client, only_dummy_service_and_api, backups):
|
||||||
snaps = api_last_slice(authorized_client)
|
snaps = api_last_slice(authorized_client)
|
||||||
|
|
||||||
assert len(snaps) == 2
|
assert len(snaps) == 2
|
||||||
|
|
||||||
|
|
||||||
|
def test_backup_all_restore_all(
|
||||||
|
authorized_client,
|
||||||
|
backups,
|
||||||
|
generic_userdata,
|
||||||
|
dkim_file,
|
||||||
|
only_dummy_service_and_api,
|
||||||
|
catch_nixos_rebuild_calls,
|
||||||
|
):
|
||||||
|
dummy_service = only_dummy_service_and_api
|
||||||
|
fp = catch_nixos_rebuild_calls
|
||||||
|
fp.pass_command(["restic", fp.any()])
|
||||||
|
fp.keep_last_process(True)
|
||||||
|
fp.pass_command(["rclone", fp.any()])
|
||||||
|
fp.keep_last_process(True)
|
||||||
|
fp.pass_command(["lsblk", fp.any()])
|
||||||
|
fp.keep_last_process(True)
|
||||||
|
|
||||||
|
response = api_total_backup(authorized_client)
|
||||||
|
data = get_data(response)["backup"]["totalBackup"]
|
||||||
|
assert_ok(data)
|
||||||
|
|
||||||
|
assert len(api_snapshots(authorized_client)) == 2
|
||||||
|
response = api_restore_all(authorized_client)
|
||||||
|
data = get_data(response)["backup"]["restoreAll"]
|
||||||
|
assert_ok(data)
|
||||||
|
# Just in case
|
||||||
|
assert len(api_snapshots(authorized_client)) == 2
|
||||||
|
|
Loading…
Reference in a new issue