mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
add python class RpcUnixSocket (does not completely work yet)
This commit is contained in:
37
deltachat-rpc-client/tests/test_rpc_unix.py
Normal file
37
deltachat-rpc-client/tests/test_rpc_unix.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from os import environ
|
||||
import platform # noqa
|
||||
import signal
|
||||
import subprocess
|
||||
from sys import stderr
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
|
||||
from deltachat_rpc_client import DeltaChat, RpcUnixSocket
|
||||
|
||||
|
||||
@pytest.mark.skipif("platform.system() == 'Windows'")
|
||||
def test_rpc_unix(tmp_path):
|
||||
socket_file = "/tmp/chatmail.sock" # path needs to be relative or short
|
||||
|
||||
path = environ.get("PATH")
|
||||
assert path is not None
|
||||
|
||||
popen = subprocess.Popen(
|
||||
f"deltachat-rpc-server --unix {socket_file}",
|
||||
shell=True,
|
||||
env=dict(
|
||||
DC_ACCOUNTS_PATH=f"{tmp_path}/accounts/test",
|
||||
rust_log="info",
|
||||
PATH=path
|
||||
)
|
||||
)
|
||||
|
||||
sleep(1) # wait until socket exists # TODO this should not be needed
|
||||
|
||||
rpc = RpcUnixSocket(socket_path=socket_file)
|
||||
with rpc:
|
||||
dc = DeltaChat(rpc)
|
||||
assert dc.rpc.get_system_info()["deltachat_core_version"] is not None
|
||||
popen.send_signal(signal.SIGINT)
|
||||
popen.wait()
|
||||
Reference in New Issue
Block a user