1
0
mirror of https://github.com/laurivosandi/certidude synced 2024-12-23 00:25:18 +00:00

Attempt to handle multithreading in tests

This commit is contained in:
Lauri Võsandi 2017-04-25 13:25:21 +03:00
parent ba9dca910f
commit d54982daed

View File

@ -5,6 +5,7 @@ from certidude.cli import entry_point as cli
from datetime import datetime, timedelta from datetime import datetime, timedelta
from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives import hashes, serialization
from cryptography.x509.oid import NameOID from cryptography.x509.oid import NameOID
import thread
from xattr import setxattr from xattr import setxattr
runner = CliRunner() runner = CliRunner()
@ -20,9 +21,7 @@ def test_cli_setup_authority():
assert authority.ca_cert.not_valid_before < datetime.now() assert authority.ca_cert.not_valid_before < datetime.now()
assert authority.ca_cert.not_valid_after > datetime.now() + timedelta(days=7000) assert authority.ca_cert.not_valid_after > datetime.now() + timedelta(days=7000)
result = runner.invoke(cli, ['serve', '-f', '-p', '8080']) thread.start_new_thread(runner.invoke, (cli, ['serve', '-p', '8080']))
assert not result.exception
from cryptography import x509 from cryptography import x509
from cryptography.hazmat.primitives.asymmetric import rsa, padding from cryptography.hazmat.primitives.asymmetric import rsa, padding