Skip to content

Commit

Permalink
clear caches for tests caching CRLs
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Jun 29, 2024
1 parent fcae3ea commit 6bfc167
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ca/django_ca/tests/base/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def assert_crl( # noqa: PLR0913
signer = signer or CertificateAuthority.objects.get(name="child")
extensions = extensions or []
now = datetime.now(tz=tz.utc)
expires_timestamp = now + timedelta(seconds=expires)
expires_timestamp = (now + timedelta(seconds=expires)).replace(microsecond=0)

if idp is not None: # pragma: no branch
extensions.append(idp)
Expand Down Expand Up @@ -236,7 +236,7 @@ def assert_crl( # noqa: PLR0913
assert parsed_crl.is_signature_valid(public_key) is True
assert parsed_crl.issuer == signer.pub.loaded.subject
assert parsed_crl.last_update_utc == last_update
assert parsed_crl.next_update_utc == expires_timestamp.replace(microsecond=0)
assert parsed_crl.next_update_utc == expires_timestamp
assert list(parsed_crl.extensions) == extensions

entries = {e.serial_number: e for e in parsed_crl}
Expand Down
2 changes: 1 addition & 1 deletion ca/django_ca/tests/commands/test_cache_crls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from django_ca.utils import get_crl_cache_key

# freeze time as otherwise CRLs might have rounding errors
pytestmark = [pytest.mark.freeze_time(TIMESTAMPS["everything_valid"])]
pytestmark = [pytest.mark.freeze_time(TIMESTAMPS["everything_valid"]), pytest.mark.usefixtures("clear_cache")]


def assert_crl_by_ca(ca: CertificateAuthority, expected: Optional[list[Certificate]] = None) -> None:
Expand Down

0 comments on commit 6bfc167

Please sign in to comment.