def test_transfer_direct_true(self):
    with self.mock_runner() as mock_runner:
        self.copier.transfer(self.data)
        self.assertCalledOnce(mock_runner.run)
        mock_runner.reset_mock()
        self.cfg.set_override('retry', 2, 'migrate')
        mock_runner.run.side_effect = remote_runner.RemoteExecutionError()
        with mock.patch.object(self.copier, 'clean_dst') as mock_clean_dst:
            self.assertRaises(base.FileCopyError, self.copier.transfer, self.data)
            self.assertEqual(2, mock_runner.run.call_count)
            self.assertCalledOnce(mock_clean_dst)
def test_transfer_direct_true(self):
    with self.mock_runner() as mock_runner:
        self.copier.transfer(self.data)
        self.assertCalledOnce(mock_runner.run)
        mock_runner.reset_mock()
        self.cfg.set_override('retry', 2, 'migrate')
        mock_runner.run.side_effect = remote_runner.RemoteExecutionError()
        with mock.patch.object(self.copier, 'clean_dst') as mock_clean_dst:
            self.assertRaises(base.FileCopyError, self.copier.transfer, self.data)
            self.assertEqual(2, mock_runner.run.call_count)
            self.assertCalledOnce(mock_clean_dst)