management.tests.test_forms.test_tls_importΒΆ

Test suite for TLS import forms.

ClassesΒΆ

TlsAddFileImportPkcs12FormTest

Test suite for TlsAddFileImportPkcs12Form.

TlsAddFileImportSeparateFilesFormTest

Test suite for TlsAddFileImportSeparateFilesForm.

Module ContentsΒΆ

class management.tests.test_forms.test_tls_import.TlsAddFileImportPkcs12FormTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for TlsAddFileImportPkcs12Form.

setUp()[source]ΒΆ

Set up test fixtures.

test_form_fields_exist()[source]ΒΆ

Test that all required form fields exist.

test_pkcs12_password_field_is_optional()[source]ΒΆ

Test that pkcs12_password field is not required.

test_domain_name_field_has_localhost_default()[source]ΒΆ

Test that domain_name has β€˜localhost’ as initial value.

test_domain_name_validator()[source]ΒΆ

Test domain name validation.

test_clean_with_valid_pkcs12_file(mock_save, mock_verify, mock_from_pkcs12)[source]ΒΆ

Test clean method with valid PKCS#12 file.

test_clean_without_pkcs12_file()[source]ΒΆ

Test clean method raises error when no file is uploaded.

test_clean_with_invalid_pkcs12_file(mock_from_pkcs12)[source]ΒΆ

Test clean method handles corrupted PKCS#12 file.

test_clean_with_password_encoding_error(mock_from_pkcs12)[source]ΒΆ

Test clean method handles password encoding errors.

test_clean_with_none_certificate(mock_verify, mock_from_pkcs12)[source]ΒΆ

Test clean method when certificate is None.

test_clean_with_invalid_certificate_type(mock_verify, mock_from_pkcs12)[source]ΒΆ

Test clean method when certificate is not x509.Certificate.

test_get_saved_credential()[source]ΒΆ

Test get_saved_credential method.

class management.tests.test_forms.test_tls_import.TlsAddFileImportSeparateFilesFormTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for TlsAddFileImportSeparateFilesForm.

setUp()[source]ΒΆ

Set up test fixtures.

test_form_fields_exist()[source]ΒΆ

Test that all required form fields exist.

test_private_key_file_password_is_optional()[source]ΒΆ

Test that private_key_file_password is optional.

test_tls_certificate_chain_is_optional()[source]ΒΆ

Test that tls_certificate_chain is optional.

test_clean_private_key_file_without_file()[source]ΒΆ

Test clean_private_key_file raises error when no file uploaded.

test_clean_private_key_file_too_large()[source]ΒΆ

Test clean_private_key_file rejects files larger than 64 kiB.

test_clean_private_key_file_valid()[source]ΒΆ

Test clean_private_key_file with valid file.

test_clean_tls_certificate_without_file()[source]ΒΆ

Test clean_tls_certificate raises error when no file uploaded.

test_clean_tls_certificate_too_large()[source]ΒΆ

Test clean_tls_certificate rejects files larger than 64 kiB.

test_clean_tls_certificate_corrupted(mock_from_bytes)[source]ΒΆ

Test clean_tls_certificate handles corrupted certificate.

test_clean_tls_certificate_valid(mock_from_bytes)[source]ΒΆ

Test clean_tls_certificate with valid certificate.

test_clean_tls_certificate_chain_valid(mock_from_bytes)[source]ΒΆ

Test clean_tls_certificate_chain with valid chain.

test_clean_tls_certificate_chain_corrupted(mock_from_bytes)[source]ΒΆ

Test clean_tls_certificate_chain handles corrupted chain.

test_clean_tls_certificate_chain_none()[source]ΒΆ

Test clean_tls_certificate_chain returns None when no file provided.

test_get_saved_credential()[source]ΒΆ

Test get_saved_credential method.

test_clean_full_flow(mock_save, mock_verify, mock_from_serializers, mock_cert_from_bytes, mock_key_from_bytes)[source]ΒΆ

Test complete clean flow with all files.