1
0
mirror of https://github.com/laurivosandi/certidude synced 2024-11-14 00:46:44 +00:00
certidude/tests/test_cli.py

26 lines
816 B
Python
Raw Normal View History

2015-09-09 05:31:48 +00:00
from click.testing import CliRunner
from certidude.cli import entry_point as cli
2016-09-18 15:30:31 +00:00
from datetime import datetime, timedelta
2015-09-09 05:31:48 +00:00
runner = CliRunner()
def test_cli_setup_authority():
2015-09-09 05:31:48 +00:00
# Authority setup
# TODO: parent, common-name, country, state, locality
2015-09-09 05:31:48 +00:00
# {authority,certificate,revocation-list}-lifetime
# organization, organizational-unit
# pkcs11
# {crl-distribution,ocsp-responder}-url
# email-address
# inbox, outbox
2016-09-18 15:30:31 +00:00
result = runner.invoke(cli, ['setup', 'authority'])
assert not result.exception
2015-09-09 05:31:48 +00:00
2016-09-18 15:30:31 +00:00
from certidude import authority
assert authority.certificate.serial_number == '0000000000000000000000000000000000000001'
assert authority.certificate.signed < datetime.now()
assert authority.certificate.expires > datetime.now() + timedelta(days=7000)
2015-09-09 05:31:48 +00:00
2016-09-18 15:30:31 +00:00