| 1 |
import httpx |
| 2 |
import pytest |
| 3 |
import socket |
| 4 |
|
| 5 |
|
| 6 |
@pytest.mark.serial |
| 7 |
def test_serve_localhost_http(ds_localhost_http_server): |
| 8 |
response = httpx.get("http://localhost:8041/_memory.json") |
| 9 |
assert { |
| 10 |
"database": "_memory", |
| 11 |
"path": "/_memory", |
| 12 |
"tables": [], |
| 13 |
}.items() <= response.json().items() |
| 14 |
|
| 15 |
|
| 16 |
@pytest.mark.serial |
| 17 |
@pytest.mark.skipif( |
| 18 |
not hasattr(socket, "AF_UNIX"), reason="Requires socket.AF_UNIX support" |
| 19 |
) |
| 20 |
def test_serve_unix_domain_socket(ds_unix_domain_socket_server): |
| 21 |
_, uds = ds_unix_domain_socket_server |
| 22 |
transport = httpx.HTTPTransport(uds=uds) |
| 23 |
client = httpx.Client(transport=transport) |
| 24 |
response = client.get("http://localhost/_memory.json") |
| 25 |
assert { |
| 26 |
"database": "_memory", |
| 27 |
"path": "/_memory", |
| 28 |
"tables": [], |
| 29 |
}.items() <= response.json().items() |