def test_process_queue_success_cb(self):
        """ Verify success callback executed on Future success"""
        mock_future = Future()
        mock_future.is_done = True
        mock_future.value = 1
        self.kafka_producer.send = MagicMock(return_value=mock_future)

        with self.assertRaises(SuccessException) as context:
            process_queue(self.event_queue, "test", self.kafka_producer,
                          self.success_cb, self.error_cb)
 def test_process_queue(self):
     """ Verify message queue is processed."""
     mock_future = Future()
     mock_future.is_done = True
     mock_future.value = 1
     self.kafka_producer.send = MagicMock(return_value=mock_future)
     with self.assertRaises(SuccessException) as context:
         process_queue(self.event_queue, "test", self.kafka_producer,
                       self.success_cb, self.error_cb)
     # Verify message queue "get" is called
     self.event_queue.get.assert_called_with()
    def test_process_queue_success_cb(self):
        """ Verify success callback executed on Future success"""
        mock_future = Future()
        mock_future.is_done = True
        mock_future.value = 1
        self.kafka_producer.send = MagicMock(return_value=mock_future)

        with self.assertRaises(SuccessException) as context:
            process_queue(self.event_queue,
                          "test",
                          self.kafka_producer,
                          self.success_cb,
                          self.error_cb)
 def test_process_queue(self):
     """ Verify message queue is processed."""
     mock_future = Future()
     mock_future.is_done = True
     mock_future.value = 1
     self.kafka_producer.send = MagicMock(return_value=mock_future)
     with self.assertRaises(SuccessException) as context:
         process_queue(self.event_queue,
                       "test",
                       self.kafka_producer,
                       self.success_cb,
                       self.error_cb)
     # Verify message queue "get" is called
     self.event_queue.get.assert_called_with()