mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-30 20:56:39 +00:00
test(root): test making socket
This commit is contained in:
parent
c8c7aed5a3
commit
644f0783ee
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue