diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..97cd662 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## Unreleased (2021-09-28) + +#### New Features + +* add option to display the text version of the x509 cert diff --git a/checkcert/checkcert.py b/checkcert/checkcert.py index 2835b0a..4900e97 100644 --- a/checkcert/checkcert.py +++ b/checkcert/checkcert.py @@ -3,8 +3,11 @@ import sys import click import M2Crypto +__version__ = "0.1.0" + @click.command() +@click.version_option(__version__, prog_name="checkcert") @click.option("--san", is_flag=True, help="Output Subject Alternate Names") @click.option( "--dump", is_flag=True, help="Dump the full text version of the x509 certificate" diff --git a/pyproject.toml b/pyproject.toml index 5140adb..db72c66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,6 @@ task-status = 'checkcert.checkcert:main' [tool.semantic_release] version_variable = [ - "task_status/task_status.py:__version__", + "checkcert/checkcert.py:__version__", "pyproject.toml:version" ] diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_checkcert.py b/tests/test_checkcert.py new file mode 100644 index 0000000..835a958 --- /dev/null +++ b/tests/test_checkcert.py @@ -0,0 +1,17 @@ +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 + + +def test_version(): + response = runner.invoke(cert_main, ["--version"]) + assert response.exit_code == 0 + assert cert_version in response.output