checkcert/tests/test_checkcert.py
Alex Kelly 26638e7e73 test: update tests to handle all branches
chore: ignore the except clauses for coverage
2021-09-30 16:23:00 -04:00

36 lines
1.1 KiB
Python

from checkcert.checkcert import main as cert_main
from checkcert.checkcert import __version__ as cert_version
from click.testing import CliRunner
runner = CliRunner()
def test_main():
if cert_main:
response = runner.invoke(cert_main, ["www.franklin.edu"])
assert response.exit_code == 0
response = runner.invoke(cert_main, ["www.franklin.edu:443"])
assert response.exit_code == 0
response = runner.invoke(cert_main, ["www.franklin.edu", "--no-color"])
assert response.exit_code == 0
def test_version():
response = runner.invoke(cert_main, ["--version"])
assert response.exit_code == 0
assert cert_version in response.output
def test_dump():
response = runner.invoke(cert_main, ["www.franklin.edu", "--dump"])
assert response.exit_code == 0
def test_san():
response = runner.invoke(cert_main, ["www.franklin.edu", "--san"])
assert response.exit_code == 0
def test_bad_cert():
response = runner.invoke(cert_main, ["support.bluequill.com", "--san"])
assert response.exit_code == 0