test: add initial test cases
This commit is contained in:
parent
a01f1575c9
commit
4b9ae5ff3f
5 changed files with 28 additions and 1 deletions
7
CHANGELOG.md
Normal file
7
CHANGELOG.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased (2021-09-28)
|
||||||
|
|
||||||
|
#### New Features
|
||||||
|
|
||||||
|
* add option to display the text version of the x509 cert
|
|
@ -3,8 +3,11 @@ import sys
|
||||||
import click
|
import click
|
||||||
import M2Crypto
|
import M2Crypto
|
||||||
|
|
||||||
|
__version__ = "0.1.0"
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
|
@click.version_option(__version__, prog_name="checkcert")
|
||||||
@click.option("--san", is_flag=True, help="Output Subject Alternate Names")
|
@click.option("--san", is_flag=True, help="Output Subject Alternate Names")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--dump", is_flag=True, help="Dump the full text version of the x509 certificate"
|
"--dump", is_flag=True, help="Dump the full text version of the x509 certificate"
|
||||||
|
|
|
@ -24,6 +24,6 @@ task-status = 'checkcert.checkcert:main'
|
||||||
|
|
||||||
[tool.semantic_release]
|
[tool.semantic_release]
|
||||||
version_variable = [
|
version_variable = [
|
||||||
"task_status/task_status.py:__version__",
|
"checkcert/checkcert.py:__version__",
|
||||||
"pyproject.toml:version"
|
"pyproject.toml:version"
|
||||||
]
|
]
|
||||||
|
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
17
tests/test_checkcert.py
Normal file
17
tests/test_checkcert.py
Normal file
|
@ -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
|
Loading…
Reference in a new issue