test: fix separator testing issues

test: add coverage for cert-not-in-san case
This commit is contained in:
Alex Kelly 2021-10-04 14:47:45 -04:00
parent 18a59afead
commit c6d657952d

View file

@ -22,6 +22,8 @@ def test_main():
assert response.exit_code == 0 assert response.exit_code == 0
response = runner.invoke(cert_main, ["www.franklin.edu", "library.franklin.edu"]) response = runner.invoke(cert_main, ["www.franklin.edu", "library.franklin.edu"])
assert response.exit_code == 0 assert response.exit_code == 0
response = runner.invoke(cert_main, ["www.franklin.edu", "--valid"])
assert response.exit_code == 0
response = runner.invoke( response = runner.invoke(
cert_main, ["www.franklin.edu:443", "library.franklin.edu"] cert_main, ["www.franklin.edu:443", "library.franklin.edu"]
) )
@ -50,20 +52,25 @@ def test_san():
def test_san_only(): def test_san_only():
"""verify --san outputs correctly""" """verify --san outputs correctly"""
check_domain = "franklin.edu" check_domain = "example.com"
response = runner.invoke(cert_main, ["--san-only", check_domain]) response = runner.invoke(cert_main, ["--san-only", check_domain])
assert response.exit_code == 0 assert response.exit_code == 0
sep_string = "," sep_string = ","
response = runner.invoke( 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 response.exit_code == 0
assert sep_string in response.output assert sep_string in response.output
sep_string = " -d "
response = runner.invoke( 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.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(): def test_bad_cert():