From 9603d893b9b72653895318c9104d754229fdb146 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Feb 2021 16:53:20 -0800 Subject: [PATCH] Tests for --ssl-keyfile and --ssl-certfile, refs #1221 --- tests/test_cli_serve_server.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/test_cli_serve_server.py diff --git a/tests/test_cli_serve_server.py b/tests/test_cli_serve_server.py new file mode 100644 index 0000000000..6962d2fd76 --- /dev/null +++ b/tests/test_cli_serve_server.py @@ -0,0 +1,20 @@ +import httpx + + +def test_serve_localhost_http(ds_localhost_http_server): + response = httpx.get("http://localhost:8041/_memory.json") + assert { + "database": "_memory", + "path": "/_memory", + "tables": [], + }.items() <= response.json().items() + + +def test_serve_localhost_https(ds_localhost_https_server): + _, client_cert = ds_localhost_https_server + response = httpx.get("https://localhost:8042/_memory.json", verify=client_cert) + assert { + "database": "_memory", + "path": "/_memory", + "tables": [], + }.items() <= response.json().items()