management.tests.test_views.test_settingsΒΆ

Test suite for settings views.

ClassesΒΆ

SettingsViewTest

Test suite for SettingsView.

ChangeLogLevelViewTest

Test suite for ChangeLogLevelView.

LogLevelsConstantTest

Test suite for LOG_LEVELS constant.

Module ContentsΒΆ

class management.tests.test_views.test_settings.SettingsViewTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for SettingsView.

setUp()[source]ΒΆ

Set up test fixtures.

test_template_name()[source]ΒΆ

Test correct template is used.

test_form_class()[source]ΒΆ

Test correct form class is used.

test_success_url()[source]ΒΆ

Test success URL is set correctly.

test_page_category_and_name()[source]ΒΆ

Test page category and name are set correctly.

test_get_form_kwargs_with_existing_config()[source]ΒΆ

Test get_form_kwargs returns existing SecurityConfig.

test_get_form_kwargs_creates_config_if_missing()[source]ΒΆ

Test get_form_kwargs creates SecurityConfig if it doesn’t exist.

test_get_context_data_includes_page_info()[source]ΒΆ

Test get_context_data includes page category and name.

test_get_context_data_includes_log_levels()[source]ΒΆ

Test get_context_data includes log levels.

test_get_context_data_includes_current_log_level()[source]ΒΆ

Test get_context_data includes current log level.

test_get_context_data_includes_notification_configs()[source]ΒΆ

Test get_context_data includes notification configurations JSON.

test_form_valid_saves_and_applies_settings(mock_apply)[source]ΒΆ

Test form_valid saves form and applies security settings.

test_form_valid_resets_settings_on_security_mode_increase(mock_apply)[source]ΒΆ

Test form_valid resets settings when security mode is increased.

test_form_valid_enables_auto_gen_pki(mock_apply, mock_enable)[source]ΒΆ

Test form_valid enables AutoGenPkiFeature when auto_gen_pki is enabled.

test_form_valid_disables_auto_gen_pki(mock_apply, mock_disable)[source]ΒΆ

Test form_valid disables AutoGenPkiFeature when auto_gen_pki is disabled.

test_form_valid_shows_success_message()[source]ΒΆ

Test form_valid displays success message.

test_form_valid_handles_missing_security_mode()[source]ΒΆ

Test form_valid handles missing security_mode value.

test_form_valid_handles_missing_key_algorithm()[source]ΒΆ

Test form_valid handles missing key algorithm when enabling auto_gen_pki.

test_form_invalid_shows_error_message()[source]ΒΆ

Test form_invalid displays error message.

test_inherits_from_form_view()[source]ΒΆ

Test SettingsView inherits from FormView.

class management.tests.test_views.test_settings.ChangeLogLevelViewTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for ChangeLogLevelView.

setUp()[source]ΒΆ

Set up test fixtures.

tearDown()[source]ΒΆ

Restore original log level.

test_post_with_valid_log_level()[source]ΒΆ

Test POST with valid log level updates logger and database.

test_post_with_invalid_log_level()[source]ΒΆ

Test POST with invalid log level shows error.

test_post_with_lowercase_log_level()[source]ΒΆ

Test POST with lowercase log level (gets converted to uppercase).

test_post_with_empty_log_level()[source]ΒΆ

Test POST with empty log level shows error.

test_post_updates_existing_logging_config()[source]ΒΆ

Test POST updates existing LoggingConfig instead of creating new one.

test_post_with_all_valid_log_levels()[source]ΒΆ

Test POST works with all valid log levels.

test_inherits_from_view()[source]ΒΆ

Test ChangeLogLevelView inherits from View.

class management.tests.test_views.test_settings.LogLevelsConstantTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for LOG_LEVELS constant.

test_log_levels_contains_all_standard_levels()[source]ΒΆ

Test LOG_LEVELS contains all standard Python logging levels.

test_log_levels_order_is_correct()[source]ΒΆ

Test LOG_LEVELS are in ascending severity order.