From 41e5f89b7b320d21f881bccc2e4b050672ee34d5 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Mon, 31 Oct 2022 13:32:17 +0000 Subject: [PATCH] migrate backblaze settings to new json format And adjust methods and tests --- selfprivacy_api/rest/services.py | 17 ++++++----- tests/test_block_device_utils/no_devices.json | 5 ---- tests/test_block_device_utils/only_root.json | 5 ---- tests/test_block_device_utils/undefined.json | 5 ---- tests/test_graphql/test_ssh/some_users.json | 5 ---- tests/test_graphql/test_system/no_values.json | 5 ---- .../test_graphql/test_system/turned_off.json | 5 ---- tests/test_graphql/test_system/turned_on.json | 5 ---- tests/test_graphql/test_system/undefined.json | 5 ---- tests/test_graphql/test_users/no_users.json | 5 ---- tests/test_graphql/test_users/one_user.json | 5 ---- tests/test_graphql/test_users/some_users.json | 5 ---- tests/test_graphql/test_users/undefined.json | 5 ---- .../test_bitwarden/enable_undefined.json | 5 ---- .../services/test_bitwarden/turned_off.json | 5 ---- .../services/test_bitwarden/turned_on.json | 5 ---- .../services/test_bitwarden/undefined.json | 5 ---- .../services/test_gitea/enable_undefined.json | 5 ---- .../services/test_gitea/turned_off.json | 5 ---- .../services/test_gitea/turned_on.json | 5 ---- .../services/test_gitea/undefined.json | 5 ---- .../test_nextcloud/enable_undefined.json | 5 ---- .../services/test_nextcloud/turned_off.json | 5 ---- .../services/test_nextcloud/turned_on.json | 5 ---- .../services/test_nextcloud/undefined.json | 5 ---- .../test_ocserv/enable_undefined.json | 5 ---- .../services/test_ocserv/turned_off.json | 5 ---- .../services/test_ocserv/turned_on.json | 5 ---- .../services/test_ocserv/undefined.json | 5 ---- .../test_pleroma/enable_undefined.json | 5 ---- .../services/test_pleroma/turned_off.json | 5 ---- .../services/test_pleroma/turned_on.json | 5 ---- .../services/test_pleroma/undefined.json | 5 ---- .../services/test_restic.py | 29 +++++++++++-------- .../services/test_restic/no_values.json | 6 ---- .../services/test_restic/some_values.json | 9 ++---- .../services/test_restic/undefined.json | 6 ---- .../services/test_ssh/all_off.json | 5 ---- .../test_ssh/root_and_admin_have_keys.json | 5 ---- .../services/test_ssh/some_users.json | 5 ---- .../services/test_ssh/turned_off.json | 5 ---- .../services/test_ssh/turned_on.json | 5 ---- .../services/test_ssh/undefined.json | 5 ---- .../services/test_ssh/undefined_values.json | 5 ---- .../test_system/no_values.json | 5 ---- .../test_system/turned_off.json | 5 ---- .../test_system/turned_on.json | 5 ---- .../test_system/undefined.json | 5 ---- .../test_users/no_users.json | 5 ---- .../test_users/one_user.json | 5 ---- .../test_users/some_users.json | 5 ---- .../test_users/undefined.json | 5 ---- 52 files changed, 28 insertions(+), 274 deletions(-) diff --git a/selfprivacy_api/rest/services.py b/selfprivacy_api/rest/services.py index c9d5ff9..ca2bc9b 100644 --- a/selfprivacy_api/rest/services.py +++ b/selfprivacy_api/rest/services.py @@ -257,24 +257,25 @@ async def restore_restic_backup(backup: BackupRestoreInput): raise HTTPException(status_code=404, detail="Backup not found") -class BackblazeConfigInput(BaseModel): +class BackupConfigInput(BaseModel): accountId: str accountKey: str bucket: str @router.put("/restic/backblaze/config") -async def set_backblaze_config(backblaze_config: BackblazeConfigInput): +async def set_backblaze_config(backup_config: BackupConfigInput): with WriteUserData() as data: - if "backblaze" not in data: - data["backblaze"] = {} - data["backblaze"]["accountId"] = backblaze_config.accountId - data["backblaze"]["accountKey"] = backblaze_config.accountKey - data["backblaze"]["bucket"] = backblaze_config.bucket + if "backup" not in data: + data["backup"] = {} + data["backup"]["provider"] = "BACKBLAZE" + data["backup"]["accountId"] = backup_config.accountId + data["backup"]["accountKey"] = backup_config.accountKey + data["backup"]["bucket"] = backup_config.bucket restic_tasks.update_keys_from_userdata() - return "New Backblaze settings saved" + return "New backup settings saved" @router.post("/ssh/enable") diff --git a/tests/test_block_device_utils/no_devices.json b/tests/test_block_device_utils/no_devices.json index 0918cd8..c395b21 100644 --- a/tests/test_block_device_utils/no_devices.json +++ b/tests/test_block_device_utils/no_devices.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_block_device_utils/only_root.json b/tests/test_block_device_utils/only_root.json index 9c064c0..1026ed0 100644 --- a/tests/test_block_device_utils/only_root.json +++ b/tests/test_block_device_utils/only_root.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_block_device_utils/undefined.json b/tests/test_block_device_utils/undefined.json index e764ebc..f5edda8 100644 --- a/tests/test_block_device_utils/undefined.json +++ b/tests/test_block_device_utils/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_ssh/some_users.json b/tests/test_graphql/test_ssh/some_users.json index 6bc3525..c02d216 100644 --- a/tests/test_graphql/test_ssh/some_users.json +++ b/tests/test_graphql/test_ssh/some_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_system/no_values.json b/tests/test_graphql/test_system/no_values.json index 110c762..779691f 100644 --- a/tests/test_graphql/test_system/no_values.json +++ b/tests/test_graphql/test_system/no_values.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_system/turned_off.json b/tests/test_graphql/test_system/turned_off.json index 3fdbb8a..5fc287c 100644 --- a/tests/test_graphql/test_system/turned_off.json +++ b/tests/test_graphql/test_system/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_system/turned_on.json b/tests/test_graphql/test_system/turned_on.json index ab1723f..c6b758b 100644 --- a/tests/test_graphql/test_system/turned_on.json +++ b/tests/test_graphql/test_system/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_system/undefined.json b/tests/test_graphql/test_system/undefined.json index 1720527..2e31fea 100644 --- a/tests/test_graphql/test_system/undefined.json +++ b/tests/test_graphql/test_system/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_users/no_users.json b/tests/test_graphql/test_users/no_users.json index 27207fb..a40fb88 100644 --- a/tests/test_graphql/test_users/no_users.json +++ b/tests/test_graphql/test_users/no_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_users/one_user.json b/tests/test_graphql/test_users/one_user.json index bd3efc8..7e1cced 100644 --- a/tests/test_graphql/test_users/one_user.json +++ b/tests/test_graphql/test_users/one_user.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_users/some_users.json b/tests/test_graphql/test_users/some_users.json index 6bc3525..c02d216 100644 --- a/tests/test_graphql/test_users/some_users.json +++ b/tests/test_graphql/test_users/some_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_graphql/test_users/undefined.json b/tests/test_graphql/test_users/undefined.json index f0826c4..ae9cd9e 100644 --- a/tests/test_graphql/test_users/undefined.json +++ b/tests/test_graphql/test_users/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_bitwarden/enable_undefined.json b/tests/test_rest_endpoints/services/test_bitwarden/enable_undefined.json index e359a16..1a95e85 100644 --- a/tests/test_rest_endpoints/services/test_bitwarden/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_bitwarden/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_bitwarden/turned_off.json b/tests/test_rest_endpoints/services/test_bitwarden/turned_off.json index fcad1f5..c1691ea 100644 --- a/tests/test_rest_endpoints/services/test_bitwarden/turned_off.json +++ b/tests/test_rest_endpoints/services/test_bitwarden/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_bitwarden/turned_on.json b/tests/test_rest_endpoints/services/test_bitwarden/turned_on.json index 7ad9081..42999d8 100644 --- a/tests/test_rest_endpoints/services/test_bitwarden/turned_on.json +++ b/tests/test_rest_endpoints/services/test_bitwarden/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_bitwarden/undefined.json b/tests/test_rest_endpoints/services/test_bitwarden/undefined.json index 1deab31..ee288c2 100644 --- a/tests/test_rest_endpoints/services/test_bitwarden/undefined.json +++ b/tests/test_rest_endpoints/services/test_bitwarden/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_gitea/enable_undefined.json b/tests/test_rest_endpoints/services/test_gitea/enable_undefined.json index fd67d96..f9fb878 100644 --- a/tests/test_rest_endpoints/services/test_gitea/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_gitea/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_gitea/turned_off.json b/tests/test_rest_endpoints/services/test_gitea/turned_off.json index fcad1f5..c1691ea 100644 --- a/tests/test_rest_endpoints/services/test_gitea/turned_off.json +++ b/tests/test_rest_endpoints/services/test_gitea/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_gitea/turned_on.json b/tests/test_rest_endpoints/services/test_gitea/turned_on.json index 50ce50b..f9a1eaf 100644 --- a/tests/test_rest_endpoints/services/test_gitea/turned_on.json +++ b/tests/test_rest_endpoints/services/test_gitea/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_gitea/undefined.json b/tests/test_rest_endpoints/services/test_gitea/undefined.json index d6187cc..a50a070 100644 --- a/tests/test_rest_endpoints/services/test_gitea/undefined.json +++ b/tests/test_rest_endpoints/services/test_gitea/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_nextcloud/enable_undefined.json b/tests/test_rest_endpoints/services/test_nextcloud/enable_undefined.json index 8f00842..19f1f2d 100644 --- a/tests/test_rest_endpoints/services/test_nextcloud/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_nextcloud/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_nextcloud/turned_off.json b/tests/test_rest_endpoints/services/test_nextcloud/turned_off.json index 8b6f466..b80ad9e 100644 --- a/tests/test_rest_endpoints/services/test_nextcloud/turned_off.json +++ b/tests/test_rest_endpoints/services/test_nextcloud/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_nextcloud/turned_on.json b/tests/test_rest_endpoints/services/test_nextcloud/turned_on.json index fcad1f5..c1691ea 100644 --- a/tests/test_rest_endpoints/services/test_nextcloud/turned_on.json +++ b/tests/test_rest_endpoints/services/test_nextcloud/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_nextcloud/undefined.json b/tests/test_rest_endpoints/services/test_nextcloud/undefined.json index dd13c56..46c09f3 100644 --- a/tests/test_rest_endpoints/services/test_nextcloud/undefined.json +++ b/tests/test_rest_endpoints/services/test_nextcloud/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ocserv/enable_undefined.json b/tests/test_rest_endpoints/services/test_ocserv/enable_undefined.json index a509d77..e080110 100644 --- a/tests/test_rest_endpoints/services/test_ocserv/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_ocserv/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ocserv/turned_off.json b/tests/test_rest_endpoints/services/test_ocserv/turned_off.json index 8542a7c..1c08123 100644 --- a/tests/test_rest_endpoints/services/test_ocserv/turned_off.json +++ b/tests/test_rest_endpoints/services/test_ocserv/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ocserv/turned_on.json b/tests/test_rest_endpoints/services/test_ocserv/turned_on.json index 8b6f466..b80ad9e 100644 --- a/tests/test_rest_endpoints/services/test_ocserv/turned_on.json +++ b/tests/test_rest_endpoints/services/test_ocserv/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ocserv/undefined.json b/tests/test_rest_endpoints/services/test_ocserv/undefined.json index 7ffae11..12eb73a 100644 --- a/tests/test_rest_endpoints/services/test_ocserv/undefined.json +++ b/tests/test_rest_endpoints/services/test_ocserv/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_pleroma/enable_undefined.json b/tests/test_rest_endpoints/services/test_pleroma/enable_undefined.json index 5d359c2..0903875 100644 --- a/tests/test_rest_endpoints/services/test_pleroma/enable_undefined.json +++ b/tests/test_rest_endpoints/services/test_pleroma/enable_undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_pleroma/turned_off.json b/tests/test_rest_endpoints/services/test_pleroma/turned_off.json index 74bfb7c..813c01f 100644 --- a/tests/test_rest_endpoints/services/test_pleroma/turned_off.json +++ b/tests/test_rest_endpoints/services/test_pleroma/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_pleroma/turned_on.json b/tests/test_rest_endpoints/services/test_pleroma/turned_on.json index 8542a7c..1c08123 100644 --- a/tests/test_rest_endpoints/services/test_pleroma/turned_on.json +++ b/tests/test_rest_endpoints/services/test_pleroma/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_pleroma/undefined.json b/tests/test_rest_endpoints/services/test_pleroma/undefined.json index dcfe1e1..77d8ad2 100644 --- a/tests/test_rest_endpoints/services/test_pleroma/undefined.json +++ b/tests/test_rest_endpoints/services/test_pleroma/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_restic.py b/tests/test_rest_endpoints/services/test_restic.py index 9502be5..844ff34 100644 --- a/tests/test_rest_endpoints/services/test_restic.py +++ b/tests/test_rest_endpoints/services/test_restic.py @@ -161,7 +161,7 @@ def mock_restic_tasks(mocker): @pytest.fixture def undefined_settings(mocker, datadir): mocker.patch("selfprivacy_api.utils.USERDATA_FILE", new=datadir / "undefined.json") - assert "backblaze" not in read_json(datadir / "undefined.json") + assert "backup" not in read_json(datadir / "undefined.json") return datadir @@ -170,20 +170,22 @@ def some_settings(mocker, datadir): mocker.patch( "selfprivacy_api.utils.USERDATA_FILE", new=datadir / "some_values.json" ) - assert "backblaze" in read_json(datadir / "some_values.json") - assert read_json(datadir / "some_values.json")["backblaze"]["accountId"] == "ID" - assert read_json(datadir / "some_values.json")["backblaze"]["accountKey"] == "KEY" - assert read_json(datadir / "some_values.json")["backblaze"]["bucket"] == "BUCKET" + assert "backup" in read_json(datadir / "some_values.json") + assert read_json(datadir / "some_values.json")["backup"]["provider"] == "BACKBLAZE" + assert read_json(datadir / "some_values.json")["backup"]["accountId"] == "ID" + assert read_json(datadir / "some_values.json")["backup"]["accountKey"] == "KEY" + assert read_json(datadir / "some_values.json")["backup"]["bucket"] == "BUCKET" return datadir @pytest.fixture def no_values(mocker, datadir): mocker.patch("selfprivacy_api.utils.USERDATA_FILE", new=datadir / "no_values.json") - assert "backblaze" in read_json(datadir / "no_values.json") - assert "accountId" not in read_json(datadir / "no_values.json")["backblaze"] - assert "accountKey" not in read_json(datadir / "no_values.json")["backblaze"] - assert "bucket" not in read_json(datadir / "no_values.json")["backblaze"] + assert "backup" in read_json(datadir / "no_values.json") + assert "provider" not in read_json(datadir / "no_values.json")["backup"] + assert "accountId" not in read_json(datadir / "no_values.json")["backup"] + assert "accountKey" not in read_json(datadir / "no_values.json")["backup"] + assert "bucket" not in read_json(datadir / "no_values.json")["backup"] return datadir @@ -462,7 +464,8 @@ def test_set_backblaze_config( ) assert response.status_code == 200 assert mock_restic_tasks.update_keys_from_userdata.call_count == 1 - assert read_json(some_settings / "some_values.json")["backblaze"] == { + assert read_json(some_settings / "some_values.json")["backup"] == { + "provider": "BACKBLAZE", "accountId": "123", "accountKey": "456", "bucket": "789", @@ -478,7 +481,8 @@ def test_set_backblaze_config_on_undefined( ) assert response.status_code == 200 assert mock_restic_tasks.update_keys_from_userdata.call_count == 1 - assert read_json(undefined_settings / "undefined.json")["backblaze"] == { + assert read_json(undefined_settings / "undefined.json")["backup"] == { + "provider": "BACKBLAZE", "accountId": "123", "accountKey": "456", "bucket": "789", @@ -494,7 +498,8 @@ def test_set_backblaze_config_on_no_values( ) assert response.status_code == 200 assert mock_restic_tasks.update_keys_from_userdata.call_count == 1 - assert read_json(no_values / "no_values.json")["backblaze"] == { + assert read_json(no_values / "no_values.json")["backup"] == { + "provider": "BACKBLAZE", "accountId": "123", "accountKey": "456", "bucket": "789", diff --git a/tests/test_rest_endpoints/services/test_restic/no_values.json b/tests/test_rest_endpoints/services/test_restic/no_values.json index 0a8a0a0..3b4a2f5 100644 --- a/tests/test_rest_endpoints/services/test_restic/no_values.json +++ b/tests/test_rest_endpoints/services/test_restic/no_values.json @@ -1,6 +1,4 @@ { - "backblaze": { - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -70,9 +68,5 @@ "provider": "HETZNER" }, "backup": { - "provider": "BACKBLAZE", - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_restic/some_values.json b/tests/test_rest_endpoints/services/test_restic/some_values.json index aa3a19f..c003d10 100644 --- a/tests/test_rest_endpoints/services/test_restic/some_values.json +++ b/tests/test_rest_endpoints/services/test_restic/some_values.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "BUCKET" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false @@ -76,6 +71,6 @@ "provider": "BACKBLAZE", "accountId": "ID", "accountKey": "KEY", - "bucket": "selfprivacy" + "bucket": "BUCKET" } -} \ No newline at end of file +} diff --git a/tests/test_rest_endpoints/services/test_restic/undefined.json b/tests/test_rest_endpoints/services/test_restic/undefined.json index df6380a..5bd1220 100644 --- a/tests/test_rest_endpoints/services/test_restic/undefined.json +++ b/tests/test_rest_endpoints/services/test_restic/undefined.json @@ -66,11 +66,5 @@ }, "server": { "provider": "HETZNER" - }, - "backup": { - "provider": "BACKBLAZE", - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" } } \ No newline at end of file diff --git a/tests/test_rest_endpoints/services/test_ssh/all_off.json b/tests/test_rest_endpoints/services/test_ssh/all_off.json index 97d7690..051d364 100644 --- a/tests/test_rest_endpoints/services/test_ssh/all_off.json +++ b/tests/test_rest_endpoints/services/test_ssh/all_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ssh/root_and_admin_have_keys.json b/tests/test_rest_endpoints/services/test_ssh/root_and_admin_have_keys.json index fcad1f5..c1691ea 100644 --- a/tests/test_rest_endpoints/services/test_ssh/root_and_admin_have_keys.json +++ b/tests/test_rest_endpoints/services/test_ssh/root_and_admin_have_keys.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ssh/some_users.json b/tests/test_rest_endpoints/services/test_ssh/some_users.json index 0706d9e..df6380a 100644 --- a/tests/test_rest_endpoints/services/test_ssh/some_users.json +++ b/tests/test_rest_endpoints/services/test_ssh/some_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ssh/turned_off.json b/tests/test_rest_endpoints/services/test_ssh/turned_off.json index 92b2196..3856c80 100644 --- a/tests/test_rest_endpoints/services/test_ssh/turned_off.json +++ b/tests/test_rest_endpoints/services/test_ssh/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ssh/turned_on.json b/tests/test_rest_endpoints/services/test_ssh/turned_on.json index 7434d16..e60c57f 100644 --- a/tests/test_rest_endpoints/services/test_ssh/turned_on.json +++ b/tests/test_rest_endpoints/services/test_ssh/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ssh/undefined.json b/tests/test_rest_endpoints/services/test_ssh/undefined.json index 290b396..7c9af37 100644 --- a/tests/test_rest_endpoints/services/test_ssh/undefined.json +++ b/tests/test_rest_endpoints/services/test_ssh/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/services/test_ssh/undefined_values.json b/tests/test_rest_endpoints/services/test_ssh/undefined_values.json index a570880..b7b03d3 100644 --- a/tests/test_rest_endpoints/services/test_ssh/undefined_values.json +++ b/tests/test_rest_endpoints/services/test_ssh/undefined_values.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/test_system/no_values.json b/tests/test_rest_endpoints/test_system/no_values.json index 442b62d..5c1431e 100644 --- a/tests/test_rest_endpoints/test_system/no_values.json +++ b/tests/test_rest_endpoints/test_system/no_values.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/test_system/turned_off.json b/tests/test_rest_endpoints/test_system/turned_off.json index 3a4a238..2336f36 100644 --- a/tests/test_rest_endpoints/test_system/turned_off.json +++ b/tests/test_rest_endpoints/test_system/turned_off.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/test_system/turned_on.json b/tests/test_rest_endpoints/test_system/turned_on.json index 7ad9081..42999d8 100644 --- a/tests/test_rest_endpoints/test_system/turned_on.json +++ b/tests/test_rest_endpoints/test_system/turned_on.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/test_system/undefined.json b/tests/test_rest_endpoints/test_system/undefined.json index fd1efad..6b9f3fd 100644 --- a/tests/test_rest_endpoints/test_system/undefined.json +++ b/tests/test_rest_endpoints/test_system/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/test_users/no_users.json b/tests/test_rest_endpoints/test_users/no_users.json index dadb584..5929a79 100644 --- a/tests/test_rest_endpoints/test_users/no_users.json +++ b/tests/test_rest_endpoints/test_users/no_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/test_users/one_user.json b/tests/test_rest_endpoints/test_users/one_user.json index 71d6338..6c553bc 100644 --- a/tests/test_rest_endpoints/test_users/one_user.json +++ b/tests/test_rest_endpoints/test_users/one_user.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/test_users/some_users.json b/tests/test_rest_endpoints/test_users/some_users.json index 0706d9e..df6380a 100644 --- a/tests/test_rest_endpoints/test_users/some_users.json +++ b/tests/test_rest_endpoints/test_users/some_users.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false diff --git a/tests/test_rest_endpoints/test_users/undefined.json b/tests/test_rest_endpoints/test_users/undefined.json index fcad1f5..c1691ea 100644 --- a/tests/test_rest_endpoints/test_users/undefined.json +++ b/tests/test_rest_endpoints/test_users/undefined.json @@ -1,9 +1,4 @@ { - "backblaze": { - "accountId": "ID", - "accountKey": "KEY", - "bucket": "selfprivacy" - }, "api": { "token": "TEST_TOKEN", "enableSwagger": false