setup_wizard.tests.test_views.test_hsmsetupmixinΒΆ

Tests for the HsmSetupMixin class.

ClassesΒΆ

ConcreteHsmSetupMixin

Concrete implementation of HsmSetupMixin for testing purposes.

HsmSetupMixinTestCase

Test cases for HsmSetupMixin.

Module ContentsΒΆ

class setup_wizard.tests.test_views.test_hsmsetupmixin.ConcreteHsmSetupMixin[source]ΒΆ

Bases: setup_wizard.views.HsmSetupMixin, django.views.generic.FormView[setup_wizard.forms.HsmSetupForm]

Concrete implementation of HsmSetupMixin for testing purposes.

get_setup_type()[source]ΒΆ

Return the setup type for the HSM script.

Return type:

str

get_error_redirect_url()[source]ΒΆ

Return the URL to redirect to on error.

Return type:

str

get_success_context()[source]ΒΆ

Return context string for success messages.

Return type:

str

get_expected_wizard_state()[source]ΒΆ

Return the expected wizard state for this view.

Return type:

setup_wizard.SetupWizardState

class setup_wizard.tests.test_views.test_hsmsetupmixin.HsmSetupMixinTestCase(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test cases for HsmSetupMixin.

setUp()[source]ΒΆ

Set up test data.

test_validate_hsm_inputs_valid_data()[source]ΒΆ

Test that valid HSM inputs pass validation.

test_validate_hsm_inputs_invalid_module_path()[source]ΒΆ

Test that invalid module path fails validation.

test_validate_hsm_inputs_invalid_slot()[source]ΒΆ

Test that invalid slot fails validation.

test_validate_hsm_inputs_invalid_label()[source]ΒΆ

Test that invalid label fails validation.

test_run_hsm_setup_script_success(mock_subprocess)[source]ΒΆ

Test successful HSM setup script execution.

test_get_or_update_token_create_new(mock_token_model)[source]ΒΆ

Test creating a new PKCS11Token.

test_assign_token_to_crypto_storage_softhsm(mock_get_config)[source]ΒΆ

Test assigning SoftHSM token to crypto storage.

test_generate_kek_and_dek_success()[source]ΒΆ

Test successful KEK and DEK generation.

test_generate_kek_and_dek_kek_failure()[source]ΒΆ

Test KEK generation failure with warning message.

test_raise_called_process_error()[source]ΒΆ

Test raising CalledProcessError with correct parameters.

test_add_success_message_created()[source]ΒΆ

Test success message for newly created token.

test_map_exit_code_to_message_known_codes()[source]ΒΆ

Test mapping of known exit codes to error messages.

test_map_exit_code_to_message_unknown_code()[source]ΒΆ

Test mapping of unknown exit code.

test_handle_hsm_setup_exception_called_process_error()[source]ΒΆ

Test handling of CalledProcessError exception.

test_form_valid_physical_hsm_not_supported()[source]ΒΆ

Test form validation with unsupported physical HSM.

test_form_valid_success_flow(mock_super_form_valid)[source]ΒΆ

Test successful form validation flow.

test_inheritance_structure()[source]ΒΆ

Test that HsmSetupMixin properly inherits from LoggerMixin.

test_abstract_methods_implementation()[source]ΒΆ

Test that abstract methods are properly implemented in test class.