From a1637181202104976f7418b09302ea45ad670566 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Fri, 29 Sep 2023 15:50:40 +0000 Subject: [PATCH] test(service): start nonexistent service --- tests/test_graphql/test_services.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_graphql/test_services.py b/tests/test_graphql/test_services.py index bc9eab0..712b11b 100644 --- a/tests/test_graphql/test_services.py +++ b/tests/test_graphql/test_services.py @@ -93,6 +93,16 @@ allServices { """ +def assert_notfound(data): + assert_errorcode(data, 404) + + +def assert_errorcode(data, errorcode): + assert data["code"] == errorcode + assert data["success"] is False + assert data["message"] is not None + + def api_enable(client, service: Service) -> dict: return api_enable_by_name(client, service.get_id()) @@ -221,6 +231,15 @@ def test_stop_return_value(authorized_client, only_dummy_service): assert service["status"] == ServiceStatus.INACTIVE.value +def test_start_nonexistent(authorized_client, only_dummy_service): + dummy_service = only_dummy_service + mutation_response = api_start_by_name(authorized_client, "bogus_service") + data = get_data(mutation_response)["services"]["startService"] + assert_notfound(data) + + assert data["service"] is None + + def test_stop_start(authorized_client, only_dummy_service): dummy_service = only_dummy_service