예제 #1
0
 def test_accept(self):
     reader = Mock()
     impl = Mock()
     body = 'test-body'
     message = Message(reader, impl, body)
     message.ack()
     reader.ack.assert_called_with(impl)
예제 #2
0
 def test_reject(self):
     reader = Mock()
     impl = Mock()
     body = 'test-body'
     message = Message(reader, impl, body)
     message.reject(True)
     reader.reject.assert_called_with(impl, True)
예제 #3
0
 def test_reject(self):
     reader = Mock()
     impl = Mock()
     body = 'test-body'
     message = Message(reader, impl, body)
     message.reject(True)
     reader.reject.assert_called_with(impl, True)
예제 #4
0
 def test_accept(self):
     reader = Mock()
     impl = Mock()
     body = 'test-body'
     message = Message(reader, impl, body)
     message.ack()
     reader.ack.assert_called_with(impl)
예제 #5
0
 def test_init(self):
     reader = Mock()
     impl = Mock()
     body = 'test-body'
     message = Message(reader, impl, body)
     self.assertEqual(message._reader, reader)
     self.assertEqual(message._impl, impl)
     self.assertEqual(message._body, body)
예제 #6
0
파일: consumer.py 프로젝트: swipswaps/gofer
 def get(self, timeout=None):
     """
     Get the next message from the queue.
     :param timeout: The read timeout in seconds.
     :type timeout: int
     :return: The next message or None.
     :rtype: Message
     """
     try:
         impl = self.receiver.receive(timeout or NO_DELAY)
         return Message(self, impl, impl.body)
     except Timeout:
         pass
예제 #7
0
 def test_str(self):
     reader = Mock()
     impl = Mock()
     body = 'test-body'
     message = Message(reader, impl, body)
     self.assertEqual(str(message), body)
예제 #8
0
 def test_body(self):
     reader = Mock()
     impl = Mock()
     body = 'test-body'
     message = Message(reader, impl, body)
     self.assertEqual(message.body, body)