'Mock the XQueue method for sending a task to the queue.'

@contextmanager
def _mock_xqueue(self, success=True):

    with patch.object(XQueueInterface, 'send_to_queue') as mock_send:
        mock_send.return_value = ((0, None) if success else (1, self.ERROR_MSG))
        (yield mock_send)
