def test_message_pop(self): with mock.patch.object(self.transport, 'send', autospec=True) as send_method: resp = response.Response(None, '{}') send_method.return_value = resp req = request.Request() core.message_pop(self.transport, req, 'test', count=5) self.assertIn('queue_name', req.params) self.assertIn('pop', req.params) self.assertEqual(5, req.params['pop'])
def pop(self, count=1): """Pop `count` messages from the server :param count: Number of messages to pop. :type count: int :returns: List of messages :rtype: `list` """ req, trans = self.client._request_and_transport() msgs = core.message_pop(trans, req, self._name, count=count) return iterator._Iterator(self.client, msgs, 'messages', message.create_object(self))
def pop(self, count=1): """Pop `count` messages from the server :param count: Number of messages to pop. :type count: int :returns: List of messages :rtype: `list` """ req, trans = self.client._request_and_transport() msgs = core.message_pop(trans, req, self._name, count=count) return iterator._Iterator(self.client, msgs, 'messages', message.create_object(self))