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 c9da128
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions ca/django_ca/static/django_ca/admin/js/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ document.addEventListener('DOMContentLoaded', function() {
const csr_data = await csr_response.json();
const subject = csr_data["subject"];

// Set the data-fetched property, so that Selenium tests can wait for completion.
input.dataset.fetched = "true"

// No need to do anything if the CSR has an empty subject
if (subject.length === 0) {
csr_subject_input_chapter.querySelector(".no-csr").style.display = "none";
csr_subject_input_chapter.querySelector(".has-content").style.display = "none";
csr_subject_input_chapter.querySelector(".no-content").style.display = "block";

// Set the data-fetched property, so that Selenium tests can wait for completion.
input.dataset.fetched = "true";
return;
}

Expand All @@ -170,7 +170,7 @@ document.addEventListener('DOMContentLoaded', function() {
csr_subject_input_chapter.querySelector(".no-content").style.display = "none";

// Set the data-fetched property, so that Selenium tests can wait for completion.
input.dataset.fetched = "true"
input.dataset.fetched = "true";
});
}

Expand Down
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 c9da128

Please sign in to comment.