From c6d657952da79863c3f3b0823347bc02f0f49386 Mon Sep 17 00:00:00 2001 From: Alex Kelly Date: Mon, 4 Oct 2021 14:47:45 -0400 Subject: [PATCH] test: fix separator testing issues test: add coverage for cert-not-in-san case --- tests/test_checkcert.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/test_checkcert.py b/tests/test_checkcert.py index 347dfa3..1a957fb 100644 --- a/tests/test_checkcert.py +++ b/tests/test_checkcert.py @@ -22,6 +22,8 @@ def test_main(): assert response.exit_code == 0 response = runner.invoke(cert_main, ["www.franklin.edu", "library.franklin.edu"]) assert response.exit_code == 0 + response = runner.invoke(cert_main, ["www.franklin.edu", "--valid"]) + assert response.exit_code == 0 response = runner.invoke( cert_main, ["www.franklin.edu:443", "library.franklin.edu"] ) @@ -50,20 +52,25 @@ def test_san(): def test_san_only(): """verify --san outputs correctly""" - check_domain = "franklin.edu" + check_domain = "example.com" response = runner.invoke(cert_main, ["--san-only", check_domain]) assert response.exit_code == 0 sep_string = "," response = runner.invoke( - cert_main, ["--san-only", f"--sep={sep_string}", check_domain] + cert_main, ["--san-only", "--sep", sep_string, check_domain] ) assert response.exit_code == 0 assert sep_string in response.output - sep_string = " -d " response = runner.invoke( - cert_main, ["--san-only", f"--sep={sep_string}", check_domain] + cert_main, ["--san-only", "--sep", sep_string, "--pre", check_domain] ) assert response.exit_code == 0 + assert response.output.startswith(sep_string) + response = runner.invoke( + cert_main, ["--san-only", "--sep", sep_string, "--pre", "cs.franklin.edu"] + ) + assert response.exit_code == 0 + assert response.output.startswith(sep_string) def test_bad_cert():