def test_bucket_raise_error_when_is_moving(
            self, check_bucket_exists, move_files_from_bucket_to_bucket):
        operation_name = 'moving'
        error_response = dict(Error=dict(Code=403, Message='forbidden'))
        check_bucket_exists.return_value = [True, True]
        move_files_from_bucket_to_bucket.side_effect = ClientError(
            error_response, operation_name)
        source = 'source'
        target = 'target'

        with self.assertLogs('move_bucket_from_s3', level='INFO') as f:
            move_bucket_main([self.command_name, source, target])

        expected_answer = 'ERROR:move_bucket_from_s3:An error occurred (403) when calling the moving operation: ' \
                          'forbidden'
        self.assertIn(expected_answer, f.output)

        move_files_from_bucket_to_bucket.assert_called_once()
        move_files_from_bucket_to_bucket.assert_called_with(
            source, target, None, None)
 def test_with_target_bucket_does_not_exist(self, check_bucket_exist):
     check_bucket_exist.side_effect = [True, False]
     source = 'source'
     target = 'target'
     with self.assertRaises(SystemExit):
         move_bucket_main([self.command_name, source, target])
 def test_with_one_param(self):
     source_bucket = 'source'
     with self.assertRaises(SystemExit):
         move_bucket_main([self.command_name, source_bucket])
 def test_with_bucket_does_not_exist(self, check_bucket_exist):
     check_bucket_exist.return_value = False
     source = 'source'
     target = 'target'
     with self.assertRaises(SystemExit):
         move_bucket_main([self.command_name, source, target])
 def test_without_params(self):
     with self.assertRaises(SystemExit):
         move_bucket_main([self.command_name])