Skip to content

Commit

Permalink
Merge pull request #46 from OwnCA/fix_lint_tests
Browse files Browse the repository at this point in the history
Fix lint and tests
  • Loading branch information
kairoaraujo authored Jun 19, 2021
2 parents 64fac23 + 391f049 commit 13d0c96
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ init:
pipenv install --dev

all-tests:
tox -r
tox -re all_tests,pep8
coverage xml -i
coverage html -i

Expand All @@ -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'
Expand Down
6 changes: 4 additions & 2 deletions ownca/ownca.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions ownca/utils.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 = {
Expand Down
5 changes: 2 additions & 3 deletions tests/integrations/test_ca.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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'
assert ica.cert.issuer.rfc4514_string() == 'CN=ownca.org'

0 comments on commit 13d0c96

Please sign in to comment.