mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-22 16:25:17 +00:00
Clean up tests
This commit is contained in:
parent
65b401538e
commit
f19cf4652e
14
.travis.yml
14
.travis.yml
@ -7,9 +7,6 @@ after_success:
|
||||
- codecov
|
||||
virtualenv:
|
||||
system_site_packages: true
|
||||
#before_install:
|
||||
# - apt-get install -qq python-configparser python-setuptools
|
||||
# - pip install codecov pytest-cov
|
||||
install:
|
||||
- pip install -r requirements.txt
|
||||
- pip install --editable .
|
||||
@ -18,3 +15,14 @@ script:
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/pip
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-configparser
|
||||
- python-setuptools
|
||||
- python-ldap
|
||||
- python-mysql.connector
|
||||
- python-pysqlite2
|
||||
- python-cffi
|
||||
- cython
|
||||
# - pip install codecov pytest-cov
|
||||
|
@ -1,14 +0,0 @@
|
||||
from click.testing import CliRunner
|
||||
from certidude.cli import entry_point as cli
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
def test_ca_config():
|
||||
# Authority setup
|
||||
with runner.isolated_filesystem():
|
||||
result = runner.invoke(cli, ['setup', 'authority'])
|
||||
assert not result.exception
|
||||
|
||||
from certidude import authority
|
||||
assert authority.certificate.serial_number == '0000000000000000000000000000000000000001'
|
||||
# TODO: Figure out a way to properly test cert.signed, cert.expires, cert.digest, etc
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
from click.testing import CliRunner
|
||||
from certidude.cli import entry_point as cli
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
@ -13,28 +13,13 @@ def test_cli_setup_authority():
|
||||
# {crl-distribution,ocsp-responder}-url
|
||||
# email-address
|
||||
# inbox, outbox
|
||||
with runner.isolated_filesystem():
|
||||
result = runner.invoke(cli, ['setup', 'authority', 'ca'])
|
||||
|
||||
assert not result.exception
|
||||
# Check whether required files were generated
|
||||
for f in ('ca_key.pem', 'ca_crt.pem', 'ca_crl.pem',
|
||||
'serial', 'openssl.cnf.example'):
|
||||
assert os.path.isfile(os.path.join('ca', f))
|
||||
for d in ('requests', 'revoked', 'signed'):
|
||||
assert os.path.isdir(os.path.join('ca', d))
|
||||
result = runner.invoke(cli, ['setup', 'authority'])
|
||||
assert not result.exception
|
||||
|
||||
def test_cli_setup_authority_invalid_name():
|
||||
with runner.isolated_filesystem():
|
||||
result = runner.invoke(cli, ['setup', 'authority'])
|
||||
assert result.exception
|
||||
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)
|
||||
|
||||
result = runner.invoke(cli, ['setup', 'authority', '""'])
|
||||
assert result.exception
|
||||
|
||||
def test_cli_setup_authority_overwrite():
|
||||
with runner.isolated_filesystem():
|
||||
os.mkdir('foo')
|
||||
|
||||
result = runner.invoke(cli, ['setup', 'authority', 'foo'])
|
||||
assert result.exception
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user