From bb493e6b74fe3b686d7c4d9160a9eb21978a9826 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Mon, 29 Jul 2024 10:33:46 +0000 Subject: [PATCH] feature(backup): reload snapshots when migrating --- .../graphql/mutations/backup_mutations.py | 1 + tests/test_graphql/test_api_backup.py | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/selfprivacy_api/graphql/mutations/backup_mutations.py b/selfprivacy_api/graphql/mutations/backup_mutations.py index 0935575..0f81c29 100644 --- a/selfprivacy_api/graphql/mutations/backup_mutations.py +++ b/selfprivacy_api/graphql/mutations/backup_mutations.py @@ -75,6 +75,7 @@ class BackupMutations: secret = repository.local_secret if secret is not None: LocalBackupSecret.set(secret) + Backups.force_snapshot_cache_reload() else: Backups.init_repo() return GenericBackupConfigReturn( diff --git a/tests/test_graphql/test_api_backup.py b/tests/test_graphql/test_api_backup.py index 85747e3..6365ce4 100644 --- a/tests/test_graphql/test_api_backup.py +++ b/tests/test_graphql/test_api_backup.py @@ -446,19 +446,19 @@ def test_migrate(authorized_client, dummy_service, tmpdir, backups): # Reinit response = api_init( authorized_client, - configuration["provider"], - "", - "", - configuration["locationName"], - configuration["locationId"], - configuration["encryptionKey"], + kind=configuration["provider"], + login="", # user provides login and password, configuration endpoint does not + password="", # empty for file based repository + location_name=configuration["locationName"], + location_id=configuration["locationId"], + local_secret=configuration["encryptionKey"], ) data = get_data(response)["backup"]["initializeRepository"] assert_ok(data) + assert data["configuration"] == configuration new_configuration = api_settings(authorized_client) assert new_configuration == configuration - api_reload_snapshots(authorized_client) snaps = api_snapshots(authorized_client) assert len(snaps) == 1