From c60fd6ac9e6ac5a0755dd6b7391a5ff381398cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Mon, 1 May 2017 21:37:56 +0000 Subject: [PATCH] tests: Add requests.get for static serving tests --- tests/test_cli.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 0c9a00f..d026234 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -110,6 +110,15 @@ def test_cli_setup_authority(): assert r.status_code == 200 assert r.headers.get('content-type') == "application/x-x509-ca-cert" + # Test static + r = client().simulate_get("/nonexistant.html") + assert r.status_code == 404, r.text + r = client().simulate_get("/index.html") + assert r.status_code == 200, r.text + r = requests.get("/index.html") + assert r.status_code == 200, r.text + + # Test request submission buf = generate_csr(cn=u"test") @@ -208,7 +217,7 @@ def test_cli_setup_authority(): r = requests.get("http://ca.example.lan/api/revoked/", headers={"Accept":"application/x-pem-file"}) - assert r.status_code == 200, r.text + assert r.status_code == 200, "Server responded with %s" % r.text assert r.headers.get('content-type') == "application/x-pem-file" r = client().simulate_get("/api/revoked/") @@ -305,12 +314,6 @@ def test_cli_setup_authority(): assert not result.exception, result.output - # Test static - r = client().simulate_delete("/nonexistant.html") - assert r.status_code == 404, r.text - r = client().simulate_delete("/index.html") - assert r.status_code == 200, r.text - # Log can be read only by admin r = client().simulate_get("/api/log/") assert r.status_code == 401, r.text