From 391f049884b7ef0af30739faaa3c4edbf28ef903 Mon Sep 17 00:00:00 2001 From: Kairo Araujo Date: Sat, 19 Jun 2021 08:26:47 +0200 Subject: [PATCH] Fix lint and tests This commit fixes the lint and tests to make sure no more pep8 deviations. --- Makefile | 6 +----- ownca/ownca.py | 6 ++++-- ownca/utils.py | 6 +++--- tests/integrations/test_ca.py | 5 ++--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 6335ee6..286f9d1 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ init: pipenv install --dev all-tests: - tox -r + tox -re all_tests,pep8 coverage xml -i coverage html -i @@ -22,10 +22,6 @@ py38-tests: integration-tests: tox -re integrations -all-tests: - tox -re all_tests - coverage xml -i - coverage html -i publish-test: pip install 'twine>=1.5.0' diff --git a/ownca/ownca.py b/ownca/ownca.py index 68dba89..c562aa1 100644 --- a/ownca/ownca.py +++ b/ownca/ownca.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- """ -Copyright (c) 2018-2020 Kairo de Araujo +Copyright (c) 2018-2021 Kairo de Araujo """ from cryptography import x509 @@ -1138,7 +1138,9 @@ def sign_csr(self, csr, csr_public_key, maximum_days=825): csr_bytes = csr.public_bytes( encoding=serialization.Encoding.PEM ) - host_cert_dir = os.path.join(self.ca_storage, CA_CERTS_DIR, common_name) + host_cert_dir = os.path.join( + self.ca_storage, CA_CERTS_DIR, common_name + ) certificate = ca_sign_csr( self.cert, self.key, csr, csr_public_key, diff --git a/ownca/utils.py b/ownca/utils.py index d8823fb..1300e63 100644 --- a/ownca/utils.py +++ b/ownca/utils.py @@ -1,11 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- """ -Copyright (c) 2018-2020 Kairo de Araujo +Copyright (c) 2018-2021 Kairo de Araujo """ from glob import glob -import inspect import os import re @@ -92,7 +91,8 @@ def ownca_directory(ca_storage): """ if "CA_test".lower() in ca_storage.lower() and not os.getenv("TEST_MODE"): raise ValueError( - f"Not allowed {ca_storage}. Please do not use a name that contains 'ca_test'" + f"Not allowed {ca_storage}. Please do not use a name that " + + "contains 'ca_test'" ) ownca_status = { diff --git a/tests/integrations/test_ca.py b/tests/integrations/test_ca.py index 07a771e..314bf0f 100644 --- a/tests/integrations/test_ca.py +++ b/tests/integrations/test_ca.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright 2020 Kairo de Araujo +# Copyright 2020,2021 Kairo de Araujo # from cryptography import x509 @@ -181,7 +181,6 @@ def test_ica(): "certificate file in CA Storage" ) in err.value - assert isinstance(ca.key, rsa.RSAPrivateKeyWithSerialization) assert type(ca.public_key_bytes) == bytes assert ca.public_key_bytes.startswith(b"ssh-rsa") @@ -261,4 +260,4 @@ def test_ca_sign_ica(): assert ca.type == "Certificate Authority" assert ica.type == "Intermediate Certificate Authority" assert ica.cert.subject.rfc4514_string() == 'CN=ica.dev.ownca.org' - assert ica.cert.issuer.rfc4514_string() == 'CN=ownca.org' \ No newline at end of file + assert ica.cert.issuer.rfc4514_string() == 'CN=ownca.org'