From 644f0783eedacdb9fe5c7ee84df10cf210aa115e Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Tue, 19 Nov 2024 22:43:27 +0000 Subject: [PATCH] test(root): test making socket --- tests/test_root_daemon.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/test_root_daemon.py b/tests/test_root_daemon.py index 01d524c..62ff872 100644 --- a/tests/test_root_daemon.py +++ b/tests/test_root_daemon.py @@ -1,8 +1,14 @@ import pytest -from selfprivacy_api.root_daemon import get_available_commands, init, main, service_commands, services +from selfprivacy_api.root_daemon import ( + get_available_commands, + init, + main, + service_commands, + services, +) import selfprivacy_api.root_daemon -from os.path import join +from os.path import join, exists from typing import List @@ -14,22 +20,27 @@ def test_socket(mocker, tmpdir): "selfprivacy_api.root_daemon.SOCKET_PATH", new=socket_path, ) + return socket_path + def is_in_strings(list: List[str], piece: str): return any([piece in x for x in list]) - + def test_available_commands(): - commands = get_available_commands() + commands = get_available_commands() assert commands != [] assert len(commands) >= len(services) * len(service_commands) for service in services: assert is_in_strings(commands, service) -def test_init(): - init() + +def test_init(test_socket): + sock = init() + assert exists(test_socket) + assert sock is not None + def test_main(): # main() pass -