management.tests.test_pkcs11_aes_keyΒΆ
Tests for PKCS#11 Pkcs11AESKey class.
ClassesΒΆ
Test cases for the Pkcs11AESKey class. |
Module ContentsΒΆ
- class management.tests.test_pkcs11_aes_key.TestPkcs11AESKey[source]ΒΆ
Test cases for the Pkcs11AESKey class.
- mock_token(mock_session)[source]ΒΆ
Mock PKCS#11 token.
- Parameters:
mock_session (unittest.mock.Mock)
- Return type:
unittest.mock.Mock
- mock_lib(mock_token)[source]ΒΆ
Mock PKCS#11 library.
- Parameters:
mock_token (unittest.mock.Mock)
- Return type:
unittest.mock.Mock
- aes_key_with_session(mock_session)[source]ΒΆ
Create Pkcs11AESKey instance with mocked session.
- Parameters:
mock_session (unittest.mock.Mock)
- Return type:
- test_init(aes_key)[source]ΒΆ
Test Pkcs11AESKey initialization.
- Parameters:
aes_key (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None
- test_load_key_general_error(aes_key_with_session, mock_session)[source]ΒΆ
Test load_key with general error.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_load_key_initializes_session(aes_key)[source]ΒΆ
Test load_key initializes session if None.
- Parameters:
aes_key (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None
- test_generate_key_default_length(aes_key_with_session, mock_session)[source]ΒΆ
Test generate_key with default key length.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_generate_key_custom_length(aes_key_with_session, mock_session)[source]ΒΆ
Test generate_key with custom key length.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_generate_key_192_length(aes_key_with_session, mock_session)[source]ΒΆ
Test generate_key with 192-bit key length.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_generate_key_unsupported_length(aes_key_with_session)[source]ΒΆ
Test generate_key with unsupported key length.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None
- test_generate_key_another_unsupported_length(aes_key_with_session)[source]ΒΆ
Test generate_key with another unsupported key length.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None
- test_generate_key_initializes_session(aes_key)[source]ΒΆ
Test generate_key initializes session if None.
- Parameters:
aes_key (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None
- test_generate_key_failure(aes_key_with_session, mock_session)[source]ΒΆ
Test generate_key when key generation fails.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_close_with_session(aes_key_with_session, mock_session)[source]ΒΆ
Test close method when session exists.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_close_no_session(aes_key)[source]ΒΆ
Test close when no session exists.
- Parameters:
aes_key (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None
- test_close_with_exception(aes_key_with_session, mock_session)[source]ΒΆ
Test close when session.close() raises exception.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_context_manager(aes_key)[source]ΒΆ
Test context manager functionality.
- Parameters:
aes_key (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None
- test_context_manager_with_exception(aes_key)[source]ΒΆ
Test context manager functionality when exception occurs.
- Parameters:
aes_key (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None
- test_multiple_operations_workflow(mock_session)[source]ΒΆ
Test a complete workflow with multiple operations.
- Parameters:
mock_session (unittest.mock.Mock)
- Return type:
None
- test_load_then_generate_error(aes_key_with_session, mock_session)[source]ΒΆ
Test that we can handle both load and generate operations.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_all_supported_key_lengths(aes_key_with_session, mock_session)[source]ΒΆ
Test that all supported key lengths work.
- Parameters:
aes_key_with_session (management.pkcs11_util.Pkcs11AESKey)
mock_session (unittest.mock.Mock)
- Return type:
None
- test_string_representation_attributes(aes_key)[source]ΒΆ
Test that all expected attributes are present.
- Parameters:
aes_key (management.pkcs11_util.Pkcs11AESKey)
- Return type:
None