Skip to content

Commit

Permalink
minor coverage fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Mar 9, 2024
1 parent dc42c48 commit ca2d168
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ca/django_ca/ca_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def _get_hash_algorithm(setting: str, default: "HashAlgorithms") -> "AllowedHash
CA_DEFAULT_ENCODING: Encoding = getattr(settings, "CA_DEFAULT_ENCODING", Encoding.PEM)
CA_NOTIFICATION_DAYS = getattr(settings, "CA_NOTIFICATION_DAYS", [14, 7, 3, 1])
CA_CRL_PROFILES: Dict[str, Dict[str, Any]] = getattr(settings, "CA_CRL_PROFILES", _CA_CRL_PROFILES)
CA_PASSWORDS: Dict[str, str] = getattr(settings, "CA_PASSWORDS", {})
CA_PASSWORDS: Dict[str, bytes] = getattr(settings, "CA_PASSWORDS", {})

# ACME settings
CA_ENABLE_ACME = getattr(settings, "CA_ENABLE_ACME", True)
Expand Down
5 changes: 1 addition & 4 deletions ca/django_ca/key_backends/storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ def load_default_password(cls, password: Optional[bytes], info: ValidationInfo)
if info.context and password is None:
ca: CertificateAuthority = info.context.get("ca")
if ca:
settings_password = ca_settings.CA_PASSWORDS.get(ca.serial)
if isinstance(settings_password, str):
return settings_password.encode()
if isinstance(settings_password, bytes):
if settings_password := ca_settings.CA_PASSWORDS.get(ca.serial):
return settings_password

return password
Expand Down
2 changes: 1 addition & 1 deletion ca/django_ca/tests/admin/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def assert_change_response(


def assert_changelist_response(response: "HttpResponse", *objects: models.Model) -> None:
"""Assert that the passed response is a model changelist view."""
"""Assert that the passed response is a model ``changelist`` view."""
assert response.status_code == HTTPStatus.OK, f"HTTP {response.status_code}"

def sorter(obj: models.Model) -> Any:
Expand Down
1 change: 0 additions & 1 deletion ca/django_ca/tests/base/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def assert_crl(
crl : bytes
The raw CRL
expected : list
CAs/certs to be expected in this CRL.
signer
expires
algorithm
Expand Down
2 changes: 1 addition & 1 deletion ca/django_ca/tests/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def mock_slug() -> Iterator[str]:

@contextmanager
def mock_cadir(path: str) -> Iterator[None]:
"""Contextmanager to set the CA_DIR to a given path without actually creating it."""
"""Context manager to set the CA_DIR to a given path without actually creating it."""
with override_settings(CA_DIR=path), patch.object(ca_storage, "location", path), patch.object(
ca_storage, "_location", path
):
Expand Down
2 changes: 1 addition & 1 deletion ca/django_ca/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def user_client(user: "User", client: Client) -> Iterator[Client]:

@pytest.fixture()
def tmpcadir(tmp_path: Path, settings: SettingsWrapper) -> Iterator[SettingsWrapper]:
"""Fixture to create a temporary directory for storing files using the storages backend."""
"""Fixture to create a temporary directory for storing files using the StoragesBackend."""
settings.CA_DIR = str(tmp_path)

# Set the full setting and do **not** update the setting in place. This *somehow* makes a difference.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Welcome to django-ca's documentation!

Introduction <python/intro>
signals
python/backends
python/key_backends
python/extensions
python/profiles
python/models
Expand Down
2 changes: 1 addition & 1 deletion docs/source/python/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ retrieve and manipulate CAs::
>>> ca.save()

To create a new CA, you have to :py:meth:`~django_ca.managers.CertificateAuthorityManager.init`, this example
creates a minimal CA using the filesystem storage backend::
creates a minimal CA using the file system storage backend::

>>> from datetime import datetime
>>> from django_ca.key_backends import key_backends
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#####################################
``django_ca.backends`` - Key backends
#####################################
#########################################
``django_ca.key_backends`` - Key backends
#########################################

******************
Supported backends
******************
**********************
Supported key backends
**********************

.. autoclass:: django_ca.key_backends.storages.StoragesBackend

Expand Down
2 changes: 2 additions & 0 deletions docs/source/spelling_wordlist.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AllowedHashTypes
Parametrized
Psycopg
Pydantic
Quickstart
Expand All @@ -18,6 +19,7 @@ cron
datastructure
dicts
django
doctests
encipherment
env
filestorage
Expand Down
3 changes: 3 additions & 0 deletions requirements/requirements-dev-common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PyYAML==6.0.1
Sphinx==7.2.6; python_version > '3.8'
Sphinx~=7.1; python_version == '3.8'
coverage[toml]==7.4.1
pytest==8.0.1
pytest-cov==4.1.0
pytest-django==4.8.0
selenium==4.17.2
semantic-version==2.10.0
tabulate==0.9.0
Expand Down
3 changes: 0 additions & 3 deletions requirements/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ django-webtest==1.9.11
freezegun==1.4.0
pyOpenSSL>=23
pyrfc3339==1.1
pytest-cov==4.1.0
pytest-env==1.1.3
pytest-django==4.8.0
pytest-freezegun==0.4.2
pytest-random-order==1.1.1
pytest==8.0.1
requests-mock==1.11.0

0 comments on commit ca2d168

Please sign in to comment.