From 667e1c174e074085b2cc28b528b6a2158443d97c Mon Sep 17 00:00:00 2001 From: Alex Kelly Date: Mon, 4 Oct 2021 12:09:35 -0400 Subject: [PATCH] docs: add rough intro to test rtd integration --- checkcert/checkcert.py | 5 ++++- docs/source/index.rst | 2 ++ tests/test_checkcert.py | 14 +++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/checkcert/checkcert.py b/checkcert/checkcert.py index 66d10e9..c66249a 100644 --- a/checkcert/checkcert.py +++ b/checkcert/checkcert.py @@ -141,7 +141,10 @@ def main(san, dump, color, filename, valid, san_only, sep, pre, hosts): output_string = "" if pre: output_string += f"{sep}".lstrip() - output_string += f"{sep}".join(get_alt_names(hostinfo.cert)) + alt_names = get_alt_names(hostinfo.cert) + if hostinfo.hostname not in alt_names: + alt_names.insert(0, hostinfo.hostname) + output_string += f"{sep}".join(alt_names) print(output_string) break output_string += ( diff --git a/docs/source/index.rst b/docs/source/index.rst index 35c999b..da81419 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,6 +10,8 @@ Welcome to checkcert's documentation! :maxdepth: 2 :caption: Contents: + introduction + Indices and tables diff --git a/tests/test_checkcert.py b/tests/test_checkcert.py index de51e41..347dfa3 100644 --- a/tests/test_checkcert.py +++ b/tests/test_checkcert.py @@ -50,7 +50,19 @@ def test_san(): def test_san_only(): """verify --san outputs correctly""" - response = runner.invoke(cert_main, ["www.franklin.edu", "--san-only"]) + check_domain = "franklin.edu" + 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] + ) + 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] + ) assert response.exit_code == 0