util.tests.test_encrypted_fieldsΒΆ
Tests for encrypted fields module.
ClassesΒΆ
Test cases for EncryptedTextField. |
|
Test cases for EncryptedCharField. |
|
Integration tests for encryption/decryption functionality. |
Module ContentsΒΆ
- class util.tests.test_encrypted_fields.TestEncryptedTextField(methodName='runTest')[source]ΒΆ
Bases:
django.test.TestCaseTest cases for EncryptedTextField.
- test_should_encrypt_softhsm(mock_config)[source]ΒΆ
Test should_encrypt returns True for SoftHSM storage type.
- test_should_encrypt_physical_hsm(mock_config)[source]ΒΆ
Test should_encrypt returns True for Physical HSM storage type.
- Parameters:
mock_config (unittest.mock.Mock)
- test_should_encrypt_software_storage(mock_config)[source]ΒΆ
Test should_encrypt returns False for software storage type.
- test_should_encrypt_no_config(mock_config)[source]ΒΆ
Test should_encrypt raises ValidationError when no config found.
- test_should_encrypt_database_error(mock_config)[source]ΒΆ
Test should_encrypt handles database errors.
- test_get_dek_from_token(mock_token_model)[source]ΒΆ
Test get_dek retrieves DEK from token when cache is empty.
- test_get_dek_no_token(mock_token_model)[source]ΒΆ
Test get_dek raises ValidationError when no token configured.
- test_encrypt_value_success(mock_get_dek, mock_should_encrypt)[source]ΒΆ
Test successful encryption of a value.
- test_encrypt_value_no_encryption(mock_should_encrypt)[source]ΒΆ
Test encrypt_value returns original value when encryption disabled.
- test_encrypt_value_dek_error(mock_get_dek, mock_should_encrypt)[source]ΒΆ
Test encrypt_value handles DEK retrieval errors.
- test_decrypt_value_success(mock_get_dek, mock_should_encrypt)[source]ΒΆ
Test successful decryption of a value.
- test_decrypt_value_no_encryption(mock_should_encrypt)[source]ΒΆ
Test decrypt_value returns original value when encryption disabled.
- test_decrypt_value_invalid_data(mock_get_dek, mock_should_encrypt)[source]ΒΆ
Test decrypt_value handles invalid encrypted data.
- class util.tests.test_encrypted_fields.TestEncryptedCharField(methodName='runTest')[source]ΒΆ
Bases:
django.test.TestCaseTest cases for EncryptedCharField.
- test_max_length_calculation()[source]ΒΆ
Test that max_length is correctly calculated for encryption overhead.
- test_should_encrypt_inherits_from_textfield(mock_config)[source]ΒΆ
Test that EncryptedCharField should_encrypt works like EncryptedTextField.
- test_encrypt_decrypt_roundtrip(mock_get_dek, mock_should_encrypt)[source]ΒΆ
Test complete encrypt/decrypt roundtrip for EncryptedCharField.
- class util.tests.test_encrypted_fields.TestEncryptionDecryptionIntegration(methodName='runTest')[source]ΒΆ
Bases:
django.test.TestCaseIntegration tests for encryption/decryption functionality.
- test_encrypt_decrypt_various_texts(mock_get_dek, mock_should_encrypt)[source]ΒΆ
Test encryption/decryption with various text inputs.