management.tests.test_security_mixinsΒΆ

Test suite for security mixins.

ClassesΒΆ

MockSecurityFeature

Mock security feature for testing.

SecurityLevelMixinTest

Test suite for SecurityLevelMixin.

SecurityLevelMixinRedirectTest

Test suite for SecurityLevelMixinRedirect.

Module ContentsΒΆ

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

Bases: management.security.features.SecurityFeature

Mock security feature for testing.

verbose_name = 'Mock Feature'[source]ΒΆ
db_field_name = 'mock_feature'[source]ΒΆ
value = 'mock_feature_value'[source]ΒΆ
enable(**kwargs)[source]ΒΆ

Mock enable method.

Parameters:

kwargs (object)

Return type:

None

disable(**kwargs)[source]ΒΆ

Mock disable method.

Parameters:

kwargs (object)

Return type:

None

is_enabled()[source]ΒΆ

Mock is_enabled method.

Return type:

bool

class management.tests.test_security_mixins.SecurityLevelMixinTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for SecurityLevelMixin.

setUp()[source]ΒΆ

Set up test fixtures.

test_init_creates_security_manager()[source]ΒΆ

Test __init__ creates a SecurityManager instance.

test_init_with_security_feature()[source]ΒΆ

Test __init__ accepts security_feature parameter.

test_init_without_security_feature()[source]ΒΆ

Test __init__ works without security_feature parameter.

test_get_security_level_returns_current_level()[source]ΒΆ

Test get_security_level returns the current security mode.

test_get_security_level_with_different_modes()[source]ΒΆ

Test get_security_level with different security modes.

test_mixin_can_be_used_with_view_class()[source]ΒΆ

Test SecurityLevelMixin can be used in a view class.

class management.tests.test_security_mixins.SecurityLevelMixinRedirectTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for SecurityLevelMixinRedirect.

setUp()[source]ΒΆ

Set up test fixtures.

test_init_with_redirect_url()[source]ΒΆ

Test __init__ accepts disabled_by_security_level_url parameter.

test_init_without_redirect_url()[source]ΒΆ

Test __init__ works without disabled_by_security_level_url parameter.

test_dispatch_allows_access_when_feature_allowed()[source]ΒΆ

Test dispatch allows access when feature is allowed.

test_dispatch_redirects_when_feature_not_allowed()[source]ΒΆ

Test dispatch redirects when feature is not allowed.

test_dispatch_adds_error_message_on_redirect()[source]ΒΆ

Test dispatch adds error message when redirecting due to security level.

test_dispatch_calls_parent_dispatch_when_allowed()[source]ΒΆ

Test dispatch calls parent dispatch method when feature is allowed.

test_mixin_with_post_request()[source]ΒΆ

Test mixin works with POST requests.

test_mixin_with_args_and_kwargs()[source]ΒΆ

Test mixin passes args and kwargs to parent dispatch.

test_inherits_from_security_level_mixin()[source]ΒΆ

Test SecurityLevelMixinRedirect inherits from SecurityLevelMixin.

test_has_access_to_parent_methods()[source]ΒΆ

Test SecurityLevelMixinRedirect has access to parent mixin methods.

test_dispatch_with_dev_mode_allows_all_features()[source]ΒΆ

Test dispatch allows all features in DEV mode.