Skip to content

Commit

Permalink
test number of queries in GenericOCSPView and update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Jan 1, 2025
1 parent 1acf9df commit 1dde79e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 9 additions & 2 deletions ca/django_ca/tests/views/test_generic_ocsp_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import pytest
from _pytest.logging import LogCaptureFixture
from pytest_django import DjangoAssertNumQueries

from django_ca.conf import model_settings
from django_ca.key_backends.hsm.models import HSMUsePrivateKeyOptions
Expand All @@ -57,9 +58,15 @@ def child_cert(tmpcadir: Path, child_cert: Certificate, profile_ocsp: Certificat
return child_cert


def test_get(client: Client, child_cert: Certificate, profile_ocsp: Certificate) -> None:
def test_get(
django_assert_num_queries: DjangoAssertNumQueries,
client: Client,
child_cert: Certificate,
profile_ocsp: Certificate,
) -> None:
"""Test getting OCSP responses."""
response = ocsp_get(client, child_cert)
with django_assert_num_queries(2):
response = ocsp_get(client, child_cert)
assert_ocsp_response(response, child_cert, responder_certificate=profile_ocsp)


Expand Down
3 changes: 1 addition & 2 deletions ca/django_ca/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,7 @@ async def process_ocsp_request(self, data: bytes) -> HttpResponse:
class GenericOCSPView(OCSPView):
"""View providing auto-configured OCSP functionality.
This view assumes that ``ocsp/$ca_serial.(key|pem)`` point to the private/public key of a responder
certificate as created by :py:class:`~django_ca.tasks.generate_ocsp_keys`. The ``serial`` URL keyword
This view loads the responder certificate via the OCSP key backend. The ``serial`` URL keyword
argument must be the serial for this CA.
"""

Expand Down

0 comments on commit 1dde79e

Please sign in to comment.