management.tests.test_security_featuresΒΆ

Test suite for security features.

ClassesΒΆ

MockSecurityFeature

Mock security feature for testing.

SecurityFeatureTest

Test suite for SecurityFeature abstract base class.

AutoGenPkiFeatureTest

Test suite for AutoGenPkiFeature.

Module ContentsΒΆ

class management.tests.test_security_features.MockSecurityFeature[source]ΒΆ

Bases: management.security.features.SecurityFeature

Mock security feature for testing.

verbose_name = 'Mock Feature'[source]ΒΆ
db_field_name = 'mock_feature'[source]ΒΆ
_enabled = False[source]ΒΆ
classmethod enable(**kwargs)[source]ΒΆ

Mock enable method.

Parameters:

kwargs (object)

Return type:

None

classmethod disable(**kwargs)[source]ΒΆ

Mock disable method.

Parameters:

kwargs (object)

Return type:

None

classmethod is_enabled()[source]ΒΆ

Mock is_enabled method.

Return type:

bool

class management.tests.test_security_features.SecurityFeatureTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for SecurityFeature abstract base class.

test_security_feature_is_abstract()[source]ΒΆ

Test that SecurityFeature cannot be instantiated directly.

test_security_feature_has_verbose_name()[source]ΒΆ

Test that SecurityFeature has verbose_name class attribute.

test_security_feature_has_db_field_name()[source]ΒΆ

Test that SecurityFeature has db_field_name class attribute.

test_mock_security_feature_implements_interface()[source]ΒΆ

Test that MockSecurityFeature correctly implements SecurityFeature interface.

class management.tests.test_security_features.AutoGenPkiFeatureTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for AutoGenPkiFeature.

setUp()[source]ΒΆ

Set up test fixtures.

test_verbose_name()[source]ΒΆ

Test that AutoGenPkiFeature has correct verbose_name.

test_db_field_name()[source]ΒΆ

Test that AutoGenPkiFeature has correct db_field_name.

test_is_enabled_returns_false_when_disabled()[source]ΒΆ

Test is_enabled returns False when auto_gen_pki is False.

test_is_enabled_returns_true_when_enabled()[source]ΒΆ

Test is_enabled returns True when auto_gen_pki is True.

test_is_enabled_returns_false_when_no_config()[source]ΒΆ

Test is_enabled returns False when no SecurityConfig exists.

test_enable_starts_thread_when_enabled(mock_enable)[source]ΒΆ

Test enable starts a background thread when auto_gen_pki is True.

test_enable_raises_error_without_key_algorithm()[source]ΒΆ

Test enable raises ValueError when key_algorithm is not provided.

test_enable_does_not_start_thread_when_disabled()[source]ΒΆ

Test enable does not start thread when auto_gen_pki is False.

test_enable_handles_exceptions_in_thread(mock_enable)[source]ΒΆ

Test enable handles exceptions that occur in the background thread.

test_enable_with_different_key_algorithms(mock_enable)[source]ΒΆ

Test enable works with different key algorithms.

test_disable_starts_thread(mock_disable)[source]ΒΆ

Test disable starts a background thread.

test_disable_updates_security_config(mock_disable)[source]ΒΆ

Test disable updates SecurityConfig.auto_gen_pki to False.

test_disable_handles_no_security_config(mock_disable)[source]ΒΆ

Test disable handles case when no SecurityConfig exists.

test_disable_handles_exceptions_in_thread(mock_disable)[source]ΒΆ

Test disable handles exceptions that occur in the background thread.

test_disable_accepts_kwargs(mock_disable)[source]ΒΆ

Test disable accepts kwargs (even though they’re unused).

test_inherits_from_security_feature()[source]ΒΆ

Test that AutoGenPkiFeature inherits from SecurityFeature.

test_implements_all_abstract_methods()[source]ΒΆ

Test that AutoGenPkiFeature implements all abstract methods.