From aa287d9cf32e0a8dabb7d736c43ff571f0a8dfc9 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Wed, 11 Oct 2023 17:33:03 +0000 Subject: [PATCH] test(services): try moving to the same device --- tests/data/turned_on.json | 48 ++++++++--------------------- tests/test_graphql/test_services.py | 18 +++++++++++ 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/tests/data/turned_on.json b/tests/data/turned_on.json index c6b758b..5b41501 100644 --- a/tests/data/turned_on.json +++ b/tests/data/turned_on.json @@ -1,11 +1,6 @@ { - "api": { - "token": "TEST_TOKEN", - "enableSwagger": false - }, - "bitwarden": { - "enable": true - }, + "api": {"token": "TEST_TOKEN", "enableSwagger": false}, + "bitwarden": {"enable": true}, "databasePassword": "PASSWORD", "domain": "test.tld", "hashedMasterPassword": "HASHED_PASSWORD", @@ -19,38 +14,19 @@ "ssh": { "enable": true, "passwordAuthentication": true, - "rootKeys": [ - "ssh-ed25519 KEY test@pc" - ] + "rootKeys": ["ssh-ed25519 KEY test@pc"] }, "username": "tester", - "gitea": { - "enable": true - }, - "ocserv": { - "enable": true - }, - "pleroma": { - "enable": true - }, - "jitsi": { - "enable": true - }, - "autoUpgrade": { - "enable": true, - "allowReboot": true - }, + "gitea": {"enable": true}, + "ocserv": {"enable": true}, + "pleroma": {"enable": true}, + "jitsi": {"enable": true}, + "autoUpgrade": {"enable": true, "allowReboot": true}, + "useBinds": true, "timezone": "Europe/Moscow", - "sshKeys": [ - "ssh-rsa KEY test@pc" - ], - "dns": { - "provider": "CLOUDFLARE", - "apiKey": "TOKEN" - }, - "server": { - "provider": "HETZNER" - }, + "sshKeys": ["ssh-rsa KEY test@pc"], + "dns": {"provider": "CLOUDFLARE", "apiKey": "TOKEN"}, + "server": {"provider": "HETZNER"}, "backup": { "provider": "BACKBLAZE", "accountId": "ID", diff --git a/tests/test_graphql/test_services.py b/tests/test_graphql/test_services.py index df409b9..2ab6a41 100644 --- a/tests/test_graphql/test_services.py +++ b/tests/test_graphql/test_services.py @@ -5,6 +5,7 @@ from selfprivacy_api.graphql.mutations.services_mutations import ServicesMutatio import selfprivacy_api.services as service_module from selfprivacy_api.services.service import Service, ServiceStatus from selfprivacy_api.services.test_service import DummyService +from selfprivacy_api.utils.block_devices import BlockDevices import tests.test_graphql.test_api_backup from tests.test_common import raw_dummy_service, dummy_service @@ -468,3 +469,20 @@ def test_move_no_such_volume(authorized_client, only_dummy_service): # is there a meaning in returning the service in this? assert data["service"] is not None assert data["job"] is None + + +def test_move_same_volume(authorized_client, dummy_service): + # dummy_service = only_dummy_service + + # we need a drive that actually exists + root_volume = BlockDevices().get_root_block_device() + dummy_service.set_simulated_moves(False) + dummy_service.set_drive(root_volume.name) + + mutation_response = api_move(authorized_client, dummy_service, root_volume.name) + data = get_data(mutation_response)["services"]["moveService"] + assert_errorcode(data, 400) + + # is there a meaning in returning the service in this? + assert data["service"] is not None + assert data["job"] is not None