pki.tests.test_crlΒΆ

Tests for CRL (Certificate Revocation List) functionality.

AttributesΒΆ

FunctionsΒΆ

authenticated_client(issuing_ca_instance)

Create an authenticated Django test client.

api_client(issuing_ca_instance)

Create an authenticated API client with JWT token.

test_crl_generation_view_creates_crl(...)

Test that the CRL generation view creates a CRL.

test_crl_generation_with_next_parameter(...)

Test that CRL generation respects the 'next' parameter.

test_crl_generation_updates_existing_crl(...)

Test that generating a CRL multiple times updates the timestamp.

test_crl_download_pem_format(client, issuing_ca_instance)

Test downloading CRL in PEM format (default).

test_crl_download_der_format(client, issuing_ca_instance)

Test downloading CRL in DER format.

test_crl_download_no_authentication_required(client, ...)

Test that CRL download does not require authentication.

test_crl_download_without_crl_redirects(...)

Test that downloading CRL without generating it first redirects.

test_crl_download_invalid_encoding_defaults_to_pem(...)

Test that invalid encoding parameter defaults to PEM.

test_api_crl_generation(api_client, issuing_ca_instance)

Test CRL generation via REST API.

test_api_crl_download_pem(api_client, issuing_ca_instance)

Test CRL download in PEM format via REST API.

test_api_crl_download_der(api_client, issuing_ca_instance)

Test CRL download in DER format via REST API.

test_api_requires_authentication(issuing_ca_instance)

Test that API endpoints require authentication.

test_api_list_issuing_cas_includes_crl_status(...)

Test that issuing CA list includes has_crl field.

test_crl_contains_issuer_information(issuing_ca_instance)

Test that generated CRL contains correct issuer information.

test_crl_is_signed_by_issuing_ca(issuing_ca_instance)

Test that CRL is properly signed by the issuing CA.

test_crl_pem_to_der_conversion_is_valid(...)

Test that PEM to DER conversion produces valid DER.

test_crl_model_str_representation(issuing_ca_instance)

Test CrlModel string representation.

test_crl_model_repr(issuing_ca_instance)

Test CrlModel repr representation.

test_crl_model_create_from_pem_valid_crl(...)

Test creating CRL from valid PEM data.

test_crl_model_create_from_pem_invalid_signature(...)

Test that CRLs with invalid signatures are rejected.

test_crl_model_create_from_pem_wrong_issuer(...)

Test creating CRL with wrong issuer raises ValidationError.

test_crl_model_get_crl_as_crypto(issuing_ca_instance)

Test getting CRL as cryptography object.

test_crl_model_get_revoked_serial_numbers(...)

Test getting revoked serial numbers from CRL.

test_crl_model_is_certificate_revoked(issuing_ca_instance)

Test checking if certificate is revoked.

test_crl_model_is_expired(issuing_ca_instance)

Test checking if CRL is expired.

test_crl_model_get_validity_hours(issuing_ca_instance)

Test getting validity period in hours.

test_crl_model_save_active_logic(issuing_ca_instance)

Test that saving active CRL deactivates others.

test_crl_table_view(authenticated_client)

Test CRL table view displays CRLs.

test_crl_table_view_empty(authenticated_client)

Test CRL table view with no CRLs.

test_crl_detail_view(issuing_ca_instance, ...)

Test CRL detail view.

test_crl_detail_view_with_revoked_certificates(...)

Test CRL detail view with revoked certificates.

test_crl_detail_view_not_found(authenticated_client)

Test CRL detail view with non-existent CRL.

test_crl_download_view_summary(issuing_ca_instance, ...)

Test CRL download view summary page.

test_crl_download_view_pem(issuing_ca_instance, ...)

Test CRL download in PEM format.

test_crl_download_view_der(issuing_ca_instance, ...)

Test CRL download in DER format.

test_crl_download_view_pkcs7_pem(issuing_ca_instance, ...)

Test CRL download in PKCS#7 PEM format.

test_crl_download_view_pkcs7_der(issuing_ca_instance, ...)

Test CRL download in PKCS#7 DER format.

test_crl_download_view_invalid_format(...)

Test CRL download with invalid format returns 404.

test_crl_download_view_not_found(authenticated_client)

Test CRL download view with non-existent CRL.

test_crl_bulk_delete_confirm_view_no_selection(...)

Test bulk delete confirm view with no selection.

test_crl_bulk_delete_confirm_view_with_selection(...)

Test bulk delete confirm view with CRL selection.

test_crl_bulk_delete_confirm_view_post_success(...)

Test successful bulk delete of CRLs.

test_crl_bulk_delete_confirm_view_post_protected_error(...)

Test bulk delete with protected error.

test_crl_import_view_get(authenticated_client)

Test GET request to CRL import view.

test_crl_import_view_post_pem_success(...)

Test successful PEM CRL import.

test_crl_import_view_post_invalid_format(...)

Test CRL import with invalid file content.

test_crl_import_view_post_no_file(authenticated_client)

Test CRL import without file.

test_crl_import_view_post_pem_success_no_ca(...)

Test CRL import form accepts submission without CA.

Module ContentsΒΆ

pki.tests.test_crl.User[source]ΒΆ
pki.tests.test_crl.authenticated_client(issuing_ca_instance)[source]ΒΆ

Create an authenticated Django test client.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

django.test.Client

pki.tests.test_crl.api_client(issuing_ca_instance)[source]ΒΆ

Create an authenticated API client with JWT token.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

tuple[rest_framework.test.APIClient, Any]

pki.tests.test_crl.test_crl_generation_view_creates_crl(authenticated_client, issuing_ca_instance)[source]ΒΆ

Test that the CRL generation view creates a CRL.

Parameters:
  • authenticated_client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_generation_with_next_parameter(authenticated_client, issuing_ca_instance)[source]ΒΆ

Test that CRL generation respects the β€˜next’ parameter.

Parameters:
  • authenticated_client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_generation_updates_existing_crl(authenticated_client, issuing_ca_instance)[source]ΒΆ

Test that generating a CRL multiple times updates the timestamp.

Parameters:
  • authenticated_client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_download_pem_format(client, issuing_ca_instance)[source]ΒΆ

Test downloading CRL in PEM format (default).

Parameters:
  • client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_download_der_format(client, issuing_ca_instance)[source]ΒΆ

Test downloading CRL in DER format.

Parameters:
  • client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_download_no_authentication_required(client, issuing_ca_instance)[source]ΒΆ

Test that CRL download does not require authentication.

Parameters:
  • client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_download_without_crl_redirects(authenticated_client, issuing_ca_instance)[source]ΒΆ

Test that downloading CRL without generating it first redirects.

Parameters:
  • authenticated_client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_download_invalid_encoding_defaults_to_pem(client, issuing_ca_instance)[source]ΒΆ

Test that invalid encoding parameter defaults to PEM.

Parameters:
  • client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_api_crl_generation(api_client, issuing_ca_instance)[source]ΒΆ

Test CRL generation via REST API.

Parameters:
  • api_client (tuple[rest_framework.test.APIClient, Any])

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_api_crl_download_pem(api_client, issuing_ca_instance)[source]ΒΆ

Test CRL download in PEM format via REST API.

Parameters:
  • api_client (tuple[rest_framework.test.APIClient, Any])

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_api_crl_download_der(api_client, issuing_ca_instance)[source]ΒΆ

Test CRL download in DER format via REST API.

Parameters:
  • api_client (tuple[rest_framework.test.APIClient, Any])

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_api_requires_authentication(issuing_ca_instance)[source]ΒΆ

Test that API endpoints require authentication.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_api_list_issuing_cas_includes_crl_status(api_client, issuing_ca_instance)[source]ΒΆ

Test that issuing CA list includes has_crl field.

Parameters:
  • api_client (tuple[rest_framework.test.APIClient, Any])

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_contains_issuer_information(issuing_ca_instance)[source]ΒΆ

Test that generated CRL contains correct issuer information.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_is_signed_by_issuing_ca(issuing_ca_instance)[source]ΒΆ

Test that CRL is properly signed by the issuing CA.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_pem_to_der_conversion_is_valid(issuing_ca_instance)[source]ΒΆ

Test that PEM to DER conversion produces valid DER.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_str_representation(issuing_ca_instance)[source]ΒΆ

Test CrlModel string representation.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_repr(issuing_ca_instance)[source]ΒΆ

Test CrlModel repr representation.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_create_from_pem_valid_crl(issuing_ca_instance)[source]ΒΆ

Test creating CRL from valid PEM data.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_create_from_pem_invalid_signature(issuing_ca_instance)[source]ΒΆ

Test that CRLs with invalid signatures are rejected.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_create_from_pem_wrong_issuer(issuing_ca_instance)[source]ΒΆ

Test creating CRL with wrong issuer raises ValidationError.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_get_crl_as_crypto(issuing_ca_instance)[source]ΒΆ

Test getting CRL as cryptography object.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_get_revoked_serial_numbers(issuing_ca_instance)[source]ΒΆ

Test getting revoked serial numbers from CRL.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_is_certificate_revoked(issuing_ca_instance)[source]ΒΆ

Test checking if certificate is revoked.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_is_expired(issuing_ca_instance)[source]ΒΆ

Test checking if CRL is expired.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_get_validity_hours(issuing_ca_instance)[source]ΒΆ

Test getting validity period in hours.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_model_save_active_logic(issuing_ca_instance)[source]ΒΆ

Test that saving active CRL deactivates others.

Parameters:

issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_table_view(authenticated_client)[source]ΒΆ

Test CRL table view displays CRLs.

Parameters:

authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_table_view_empty(authenticated_client)[source]ΒΆ

Test CRL table view with no CRLs.

Parameters:

authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_detail_view(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test CRL detail view.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_detail_view_with_revoked_certificates(issuing_ca_instance, authenticated_client, credential_instance)[source]ΒΆ

Test CRL detail view with revoked certificates.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

  • credential_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_detail_view_not_found(authenticated_client)[source]ΒΆ

Test CRL detail view with non-existent CRL.

Parameters:

authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_download_view_summary(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test CRL download view summary page.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_download_view_pem(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test CRL download in PEM format.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_download_view_der(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test CRL download in DER format.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_download_view_pkcs7_pem(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test CRL download in PKCS#7 PEM format.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_download_view_pkcs7_der(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test CRL download in PKCS#7 DER format.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_download_view_invalid_format(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test CRL download with invalid format returns 404.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_download_view_not_found(authenticated_client)[source]ΒΆ

Test CRL download view with non-existent CRL.

Parameters:

authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_bulk_delete_confirm_view_no_selection(authenticated_client)[source]ΒΆ

Test bulk delete confirm view with no selection.

Parameters:

authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_bulk_delete_confirm_view_with_selection(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test bulk delete confirm view with CRL selection.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_bulk_delete_confirm_view_post_success(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test successful bulk delete of CRLs.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_bulk_delete_confirm_view_post_protected_error(issuing_ca_instance, authenticated_client)[source]ΒΆ

Test bulk delete with protected error.

Parameters:
  • issuing_ca_instance (dict[str, Any])

  • authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_import_view_get(authenticated_client)[source]ΒΆ

Test GET request to CRL import view.

Parameters:

authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_import_view_post_pem_success(authenticated_client, issuing_ca_instance)[source]ΒΆ

Test successful PEM CRL import.

Parameters:
  • authenticated_client (django.test.Client)

  • issuing_ca_instance (dict[str, Any])

Return type:

None

pki.tests.test_crl.test_crl_import_view_post_invalid_format(authenticated_client)[source]ΒΆ

Test CRL import with invalid file content.

Parameters:

authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_import_view_post_no_file(authenticated_client)[source]ΒΆ

Test CRL import without file.

Parameters:

authenticated_client (django.test.Client)

Return type:

None

pki.tests.test_crl.test_crl_import_view_post_pem_success_no_ca(authenticated_client)[source]ΒΆ

Test CRL import form accepts submission without CA.

Parameters:

authenticated_client (django.test.Client)

Return type:

None