util.tests.test_sftpΒΆ

Tests for util/sftp.py.

ClassesΒΆ

TestSftpClient

Tests for SftpClient class.

Module ContentsΒΆ

class util.tests.test_sftp.TestSftpClient[source]ΒΆ

Tests for SftpClient class.

test_init_with_no_backup_options()[source]ΒΆ

Test initialization when no BackupOptions exist.

Return type:

None

test_init_with_overrides()[source]ΒΆ

Test initialization with overrides dict.

Return type:

None

test_init_with_backup_options_from_db()[source]ΒΆ

Test initialization reading from BackupOptions model.

Return type:

None

test_init_overrides_take_precedence()[source]ΒΆ

Test that overrides take precedence over DB values.

Return type:

None

test_init_invalid_auth_method_raises_error()[source]ΒΆ

Test that invalid auth_method raises SftpError.

Return type:

None

test_init_password_auth_without_password_raises_error()[source]ΒΆ

Test that password auth without password raises SftpError.

Return type:

None

test_init_ssh_key_auth_without_key_raises_error()[source]ΒΆ

Test that SSH key auth without key raises SftpError.

Return type:

None

test_init_remote_directory_stripped()[source]ΒΆ

Test that remote directory is stripped of whitespace.

Return type:

None

test_load_private_key_success(mock_from_private_key)[source]ΒΆ

Test successful private key loading.

Parameters:

mock_from_private_key (unittest.mock.Mock)

Return type:

None

test_load_private_key_no_key_raises_error()[source]ΒΆ

Test that loading key without key text raises SftpError.

Return type:

None

test_load_private_key_with_passphrase(mock_from_private_key)[source]ΒΆ

Test loading encrypted private key with passphrase.

Parameters:

mock_from_private_key (unittest.mock.Mock)

Return type:

None

test_load_private_key_ssh_exception_raises_error(mock_from_private_key)[source]ΒΆ

Test that SSH exception during key load raises SftpError.

Parameters:

mock_from_private_key (unittest.mock.Mock)

Return type:

None

test_connect_sftp_no_auth_method_raises_error()[source]ΒΆ

Test that connecting without auth_method raises SftpError.

Return type:

None

test_connect_sftp_password_auth_success(mock_sftp_from_transport, mock_transport_class)[source]ΒΆ

Test successful SFTP connection with password auth.

Parameters:
  • mock_sftp_from_transport (unittest.mock.Mock)

  • mock_transport_class (unittest.mock.Mock)

Return type:

None

test_test_connection_success(mock_sftp_from_transport, mock_transport_class)[source]ΒΆ

Test successful connection test.

Parameters:
  • mock_sftp_from_transport (unittest.mock.Mock)

  • mock_transport_class (unittest.mock.Mock)

Return type:

None

test_upload_file_no_auth_method_raises_error(tmp_path)[source]ΒΆ

Test that upload without auth_method raises SftpError.

Parameters:

tmp_path (pathlib.Path)

Return type:

None

test_upload_file_nonexistent_file_raises_error()[source]ΒΆ

Test that upload of nonexistent file raises SftpError.

Return type:

None

test_upload_file_success(mock_sftp_from_transport, mock_transport_class, tmp_path)[source]ΒΆ

Test successful file upload.

Parameters:
  • mock_sftp_from_transport (unittest.mock.Mock)

  • mock_transport_class (unittest.mock.Mock)

  • tmp_path (pathlib.Path)

Return type:

None