Skip to content

Commit

Permalink
test for number of queries to assert performance
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Jan 1, 2025
1 parent ac16e33 commit 819c652
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ca/django_ca/tests/views/test_generic_ca_issuers_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@
from django.test import Client
from django.urls import reverse

from pytest_django import DjangoAssertNumQueries

from django_ca.models import CertificateAuthority


def test_generic_ca_issuers_view(usable_root: CertificateAuthority, client: Client) -> None:
def test_generic_ca_issuers_view(
django_assert_num_queries: DjangoAssertNumQueries, usable_root: CertificateAuthority, client: Client
) -> None:
"""Test the generic ca issuer view."""
url = reverse("django_ca:issuer", kwargs={"serial": usable_root.serial})
resp = client.get(url)
with django_assert_num_queries(1):
resp = client.get(url)
assert resp["Content-Type"] == "application/pkix-cert"
assert resp.content == usable_root.pub.der

0 comments on commit 819c652

Please sign in to comment.