pki.tests.test_crlΒΆ
Tests for CRL (Certificate Revocation List) functionality.
AttributesΒΆ
FunctionsΒΆ
|
Create an authenticated Django test client. |
|
Create an authenticated API client with JWT token. |
Test that the CRL generation view creates a CRL. |
|
Test that CRL generation respects the 'next' parameter. |
|
Test that generating a CRL multiple times updates the timestamp. |
|
|
Test downloading CRL in PEM format (default). |
|
Test downloading CRL in DER format. |
|
Test that CRL download does not require authentication. |
Test that downloading CRL without generating it first redirects. |
|
Test that invalid encoding parameter defaults to PEM. |
|
|
Test CRL generation via REST API. |
|
Test CRL download in PEM format via REST API. |
|
Test CRL download in DER format via REST API. |
|
Test that API endpoints require authentication. |
Test that issuing CA list includes has_crl field. |
|
|
Test that generated CRL contains correct issuer information. |
|
Test that CRL is properly signed by the issuing CA. |
Test that PEM to DER conversion produces valid DER. |
|
|
Test CrlModel string representation. |
|
Test CrlModel repr representation. |
Test creating CRL from valid PEM data. |
|
Test that CRLs with invalid signatures are rejected. |
|
Test creating CRL with wrong issuer raises ValidationError. |
|
|
Test getting CRL as cryptography object. |
Test getting revoked serial numbers from CRL. |
|
|
Test checking if certificate is revoked. |
|
Test checking if CRL is expired. |
|
Test getting validity period in hours. |
|
Test that saving active CRL deactivates others. |
|
Test CRL table view displays CRLs. |
|
Test CRL table view with no CRLs. |
|
Test CRL detail view. |
Test CRL detail view with revoked certificates. |
|
|
Test CRL detail view with non-existent CRL. |
|
Test CRL download view summary page. |
|
Test CRL download in PEM format. |
|
Test CRL download in DER format. |
|
Test CRL download in PKCS#7 PEM format. |
|
Test CRL download in PKCS#7 DER format. |
Test CRL download with invalid format returns 404. |
|
|
Test CRL download view with non-existent CRL. |
Test bulk delete confirm view with no selection. |
|
Test bulk delete confirm view with CRL selection. |
|
Test successful bulk delete of CRLs. |
|
Test bulk delete with protected error. |
|
|
Test GET request to CRL import view. |
Test successful PEM CRL import. |
|
Test CRL import with invalid file content. |
|
|
Test CRL import without file. |
Test CRL import form accepts submission without CA. |
Module ContentsΒΆ
- 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