sanic/tests/worker/test_socket.py
Adam Hopkins 4726cf1910
Sanic Server WorkerManager refactor (#2499)
Co-authored-by: Néstor Pérez <25409753+prryplatypus@users.noreply.github.com>
2022-09-18 17:17:23 +03:00

28 lines
691 B
Python

from pathlib import Path
from sanic.server.socket import (
bind_unix_socket,
configure_socket,
remove_unix_socket,
)
def test_setup_and_teardown_unix():
socket_address = "./test.sock"
path = Path.cwd() / socket_address
assert not path.exists()
bind_unix_socket(socket_address)
assert path.exists()
remove_unix_socket(socket_address)
assert not path.exists()
def test_configure_socket():
socket_address = "./test.sock"
path = Path.cwd() / socket_address
assert not path.exists()
configure_socket({"unix": socket_address, "backlog": 100})
assert path.exists()
remove_unix_socket(socket_address)
assert not path.exists()