From a754c1275d50b911f9445c9fe35a745c95f17196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Mon, 1 May 2017 20:15:45 +0000 Subject: [PATCH] tests: More API call tests --- tests/test_cli.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index e509a4b..6196598 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -81,6 +81,8 @@ def test_cli_setup_authority(): result = runner.invoke(cli, ['serve', '-f']) assert not result.exception, result.output + import requests + # Password is bot, users created by Travis usertoken = "Basic dXNlcmJvdDpib3Q=" admintoken = "Basic YWRtaW5ib3Q6Ym90" @@ -102,6 +104,10 @@ def test_cli_setup_authority(): assert r.status_code == 200 assert r.headers.get('content-type') == "application/x-x509-ca-cert" + r = requests.get("http://ca.example.lan/api/certificate") + assert r.status_code == 200 + assert r.headers.get('content-type') == "application/x-x509-ca-cert" + # Test request submission buf = generate_csr(cn=u"test") @@ -197,11 +203,20 @@ def test_cli_setup_authority(): assert r.status_code == 200 assert r.headers.get('content-type') == "application/x-pkcs7-crl" + r = requests.get("http://ca.example.lan/api/revoked/") + assert r.status_code == 200 + assert r.headers.get('content-type') == "application/x-pkcs7-crl" + r = client().simulate_get("/api/revoked/", headers={"Accept":"application/x-pem-file"}) assert r.status_code == 200 assert r.headers.get('content-type') == "application/x-pem-file" + r = requests.get("http://ca.example.lan/api/revoked/", + headers={"Accept":"application/x-pem-file"}) + assert r.status_code == 200 + assert r.headers.get('content-type') == "application/x-pem-file" + r = client().simulate_get("/api/revoked/", headers={"Accept":"text/plain"}) assert r.status_code == 415