diff --git a/tests/test_graphql/test_ssh.py b/tests/test_graphql/test_ssh.py index dc436cb..e1fe80f 100644 --- a/tests/test_graphql/test_ssh.py +++ b/tests/test_graphql/test_ssh.py @@ -9,7 +9,12 @@ from selfprivacy_api.graphql.queries.system import System from selfprivacy_api.actions.ssh import remove_ssh_key, get_ssh_settings from tests.common import read_json, generate_system_query -from tests.test_graphql.common import assert_empty, assert_ok, get_data, assert_errorcode +from tests.test_graphql.common import ( + assert_empty, + assert_ok, + get_data, + assert_errorcode, +) class ProcessMock: @@ -338,6 +343,10 @@ def test_graphql_add_ssh_key(authorized_client, some_users, mock_subprocess_pope ] +def test_graphql_get_root_key(authorized_client, some_users): + assert api_rootkeys(authorized_client) == ["ssh-ed25519 KEY test@pc"] + + def test_graphql_add_root_ssh_key(authorized_client, no_rootkeys): output = api_add_ssh_key(authorized_client, "root", "ssh-rsa KEY test_key@pc") @@ -369,6 +378,7 @@ def test_graphql_add_root_ssh_key_one_more(authorized_client, no_rootkeys): assert output["user"]["sshKeys"] == expected_keys assert api_rootkeys(authorized_client) == expected_keys + def test_graphql_add_root_ssh_key_same(authorized_client, no_rootkeys): key = "ssh-rsa KEY test_key@pc" output = api_add_ssh_key(authorized_client, "root", key) @@ -377,6 +387,7 @@ def test_graphql_add_root_ssh_key_same(authorized_client, no_rootkeys): output = api_add_ssh_key(authorized_client, "root", key) assert_errorcode(output, 409) + def test_graphql_add_main_ssh_key(authorized_client, some_users, mock_subprocess_popen): response = authorized_client.post( "/graphql", diff --git a/tests/test_rest_endpoints/services/test_ssh.py b/tests/test_rest_endpoints/services/test_ssh.py index 56a4020..f77e71f 100644 --- a/tests/test_rest_endpoints/services/test_ssh.py +++ b/tests/test_rest_endpoints/services/test_ssh.py @@ -95,12 +95,6 @@ def some_users(mocker, datadir): ## /ssh/keys/{user} ###################################################### -def test_get_root_key(authorized_client, root_and_admin_have_keys): - response = authorized_client.get("/services/ssh/keys/root") - assert response.status_code == 200 - assert response.json() == ["ssh-ed25519 KEY test@pc"] - - def test_get_root_key_when_none(authorized_client, ssh_on): response = authorized_client.get("/services/ssh/keys/root") assert response.status_code == 200