management.tests.test_commandsΒΆ

Test suite for Django management commands.

ClassesΒΆ

CompileMsgCommandTest

Test suite for compilemsg command.

MakeMsgCommandTest

Test suite for makemsg command.

PrintVersionCommandTest

Test suite for printversion command.

InitTrustpointCommandTest

Test suite for inittrustpoint command.

StartupManagerCommandTest

Test suite for startup_manager command.

TlsCredCommandTest

Test suite for tls_cred command.

TrustpointBackupCommandTest

Test suite for trustpointbackup command.

TrustpointRestoreCommandTest

Test suite for trustpointrestore command.

UnwrapDekCommandTest

Test suite for unwrap_dek command.

UpdateTlsCommandTest

Test suite for update_tls command.

ManagePyOverrideTest

Test suite for managepy_override module.

Module ContentsΒΆ

class management.tests.test_commands.CompileMsgCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for compilemsg command.

test_compilemsg_inherits_from_compilemessages()[source]ΒΆ

Test that compilemsg is an alias for compilemessages.

Return type:

None

class management.tests.test_commands.MakeMsgCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for makemsg command.

test_makemsg_has_custom_msgmerge_options()[source]ΒΆ

Test that makemsg has custom msgmerge options.

Return type:

None

class management.tests.test_commands.PrintVersionCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for printversion command.

test_printversion_outputs_app_version()[source]ΒΆ

Test that printversion outputs the application version.

Return type:

None

test_printversion_help_text()[source]ΒΆ

Test that printversion has correct help text.

Return type:

None

class management.tests.test_commands.InitTrustpointCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for inittrustpoint command.

test_inittrustpoint_with_migrations(mock_call_command, mock_open_file)[source]ΒΆ

Test inittrustpoint runs migrations by default.

Parameters:
  • mock_call_command (unittest.mock.MagicMock)

  • mock_open_file (unittest.mock.MagicMock)

Return type:

None

test_inittrustpoint_without_migrations(mock_call_command, mock_open_file)[source]ΒΆ

Test inittrustpoint skips migrations with –nomigrations.

Parameters:
  • mock_call_command (unittest.mock.MagicMock)

  • mock_open_file (unittest.mock.MagicMock)

Return type:

None

test_inittrustpoint_with_tls(mock_call_command, mock_open_file)[source]ΒΆ

Test inittrustpoint prepares TLS with –tls option.

Parameters:
  • mock_call_command (unittest.mock.MagicMock)

  • mock_open_file (unittest.mock.MagicMock)

Return type:

None

test_inittrustpoint_container_id_not_found(mock_call_command, mock_open_file)[source]ΒΆ

Test inittrustpoint handles missing /etc/hostname file.

Parameters:
  • mock_call_command (unittest.mock.MagicMock)

  • mock_open_file (unittest.mock.MagicMock)

Return type:

None

test_inittrustpoint_creates_app_version(mock_call_command, mock_open_file)[source]ΒΆ

Test inittrustpoint creates AppVersion record.

Parameters:
  • mock_call_command (unittest.mock.MagicMock)

  • mock_open_file (unittest.mock.MagicMock)

Return type:

None

class management.tests.test_commands.StartupManagerCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for startup_manager command.

test_startup_manager_db_not_initialized(mock_builder, mock_selector)[source]ΒΆ

Test startup_manager when database is not initialized.

Parameters:
  • mock_builder (unittest.mock.MagicMock)

  • mock_selector (unittest.mock.MagicMock)

Return type:

None

test_startup_manager_db_initialized_no_version(mock_builder, mock_selector)[source]ΒΆ

Test startup_manager when database is initialized but no version record.

Parameters:
  • mock_builder (unittest.mock.MagicMock)

  • mock_selector (unittest.mock.MagicMock)

Return type:

None

test_startup_manager_version_parsing()[source]ΒΆ

Test startup_manager can parse version from settings.

Return type:

None

class management.tests.test_commands.TlsCredCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for tls_cred command.

setUp()[source]ΒΆ

Set up test fixtures.

Return type:

None

test_tls_cred_write_out(mock_chain_path, mock_cert_path, mock_key_path, mock_active, mock_credential, mock_generator_class)[source]ΒΆ

Test tls_cred command with –write_out option.

Parameters:
  • mock_chain_path (unittest.mock.MagicMock)

  • mock_cert_path (unittest.mock.MagicMock)

  • mock_key_path (unittest.mock.MagicMock)

  • mock_active (unittest.mock.MagicMock)

  • mock_credential (unittest.mock.MagicMock)

  • mock_generator_class (unittest.mock.MagicMock)

Return type:

None

test_tls_cred_without_write_out(mock_active, mock_credential, mock_generator_class)[source]ΒΆ

Test tls_cred command without –write_out option.

Parameters:
  • mock_active (unittest.mock.MagicMock)

  • mock_credential (unittest.mock.MagicMock)

  • mock_generator_class (unittest.mock.MagicMock)

Return type:

None

class management.tests.test_commands.TrustpointBackupCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for trustpointbackup command.

test_trustpointbackup_with_filename(mock_call_command)[source]ΒΆ

Test trustpointbackup command with filename option.

Parameters:

mock_call_command (unittest.mock.MagicMock)

Return type:

None

test_trustpointbackup_requires_filename()[source]ΒΆ

Test trustpointbackup command requires filename.

Return type:

None

class management.tests.test_commands.TrustpointRestoreCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for trustpointrestore command.

test_trustpointrestore_without_filepath(mock_app_version, mock_active_tls, mock_call_command, mock_subprocess)[source]ΒΆ

Test trustpointrestore command without filepath option.

Parameters:
  • mock_app_version (unittest.mock.MagicMock)

  • mock_active_tls (unittest.mock.MagicMock)

  • mock_call_command (unittest.mock.MagicMock)

  • mock_subprocess (unittest.mock.MagicMock)

Return type:

None

test_trustpointrestore_with_invalid_filepath(mock_path_class)[source]ΒΆ

Test trustpointrestore when filepath doesn’t exist.

Parameters:

mock_path_class (unittest.mock.MagicMock)

Return type:

None

class management.tests.test_commands.UnwrapDekCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for unwrap_dek command.

setUp()[source]ΒΆ

Set up test fixtures.

Return type:

None

test_unwrap_dek_default_token()[source]ΒΆ

Test unwrap_dek command with default token label.

Return type:

None

test_unwrap_dek_custom_token()[source]ΒΆ

Test unwrap_dek command with custom token label.

Return type:

None

test_unwrap_dek_token_not_found()[source]ΒΆ

Test unwrap_dek when token doesn’t exist.

Return type:

None

class management.tests.test_commands.UpdateTlsCommandTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for update_tls command.

test_update_tls_success(mock_active_tls, mock_chain_path, mock_cert_path, mock_key_path, mock_path_class, mock_subprocess)[source]ΒΆ

Test update_tls command successful execution.

Parameters:
  • mock_active_tls (unittest.mock.MagicMock)

  • mock_chain_path (unittest.mock.MagicMock)

  • mock_cert_path (unittest.mock.MagicMock)

  • mock_key_path (unittest.mock.MagicMock)

  • mock_path_class (unittest.mock.MagicMock)

  • mock_subprocess (unittest.mock.MagicMock)

Return type:

None

test_update_tls_no_credential(mock_active_tls)[source]ΒΆ

Test update_tls command when no active credential exists.

Parameters:

mock_active_tls (unittest.mock.MagicMock)

Return type:

None

test_update_tls_script_failure(mock_active_tls, mock_chain_path, mock_cert_path, mock_key_path, mock_path_class, mock_subprocess)[source]ΒΆ

Test update_tls command when subprocess script fails.

Parameters:
  • mock_active_tls (unittest.mock.MagicMock)

  • mock_chain_path (unittest.mock.MagicMock)

  • mock_cert_path (unittest.mock.MagicMock)

  • mock_key_path (unittest.mock.MagicMock)

  • mock_path_class (unittest.mock.MagicMock)

  • mock_subprocess (unittest.mock.MagicMock)

Return type:

None

class management.tests.test_commands.ManagePyOverrideTest(methodName='runTest')[source]ΒΆ

Bases: django.test.TestCase

Test suite for managepy_override module.

test_override_makemigrations_function(mock_execute)[source]ΒΆ

Test override_makemigrations function exists and is callable.

Parameters:

mock_execute (unittest.mock.MagicMock)

Return type:

None

test_managepy_override_imports()[source]ΒΆ

Test that managepy_override module can be imported.

Return type:

None