def test__run_disk_export_raises_ExportError_if_not_empty_string(mocker): """ Ensure ExportError is raised if _run_disk_test returns anything other than ''. """ export = Export() export._create_archive = mocker.MagicMock(return_value="mock_archive_path") export._export_archive = mocker.MagicMock( return_value="SOMETHING_OTHER_THAN_EMPTY_STRING") with pytest.raises(ExportError): export._run_disk_export("mock_archive_dir", ["mock_filepath"], "mock_passphrase")
def test__run_disk_export_raises_ExportError_if_not_empty_string(mocker): ''' Ensure ExportError is raised if _run_disk_test returns anything other than ''. ''' export = Export() export._create_archive = mocker.MagicMock(return_value='mock_archive_path') export._export_archive = mocker.MagicMock( return_value='SOMETHING_OTHER_THAN_EMPTY_STRING') with pytest.raises(ExportError): export._run_disk_export('mock_archive_dir', ['mock_filepath'], 'mock_passphrase')
def test__run_disk_export(mocker): ''' Ensure _export_archive and _create_archive are called with the expected parameters, _export_archive is called with the return value of _create_archive, and _run_disk_test returns without error if '' is the ouput status of _export_archive. ''' export = Export() export._create_archive = mocker.MagicMock(return_value='mock_archive_path') export._export_archive = mocker.MagicMock(return_value='') export._run_disk_export('mock_archive_dir', ['mock_filepath'], 'mock_passphrase') export._export_archive.assert_called_once_with('mock_archive_path') export._create_archive.assert_called_once_with( 'mock_archive_dir', 'archive.sd-export', { 'encryption_key': 'mock_passphrase', 'device': 'disk', 'encryption_method': 'luks' }, ['mock_filepath'])
def test__run_disk_export(mocker): """ Ensure _export_archive and _create_archive are called with the expected parameters, _export_archive is called with the return value of _create_archive, and _run_disk_test returns without error if '' is the ouput status of _export_archive. """ export = Export() export._create_archive = mocker.MagicMock(return_value="mock_archive_path") export._export_archive = mocker.MagicMock(return_value="") export._run_disk_export("mock_archive_dir", ["mock_filepath"], "mock_passphrase") export._export_archive.assert_called_once_with("mock_archive_path") export._create_archive.assert_called_once_with( "mock_archive_dir", "archive.sd-export", { "encryption_key": "mock_passphrase", "device": "disk", "encryption_method": "luks" }, ["mock_filepath"], )