示例#1
0
class WhenProcessingMessage(unittest.TestCase):
    def setUp(self):
        self.consumer = Consumer()
        self.consumer.process_message = MagicMock()

        self.consumer.process(sentinel.message)

    def should_set_message(self):
        self.assertIs(self.consumer.message, sentinel.message)

    def should_call_process_message(self):
        self.consumer.process_message.assert_called_once_with()
示例#2
0
class WhenProcessingMessage(unittest.TestCase):

    def setUp(self):
        self.consumer = Consumer()
        self.consumer.process_message = MagicMock()

        self.consumer.process(sentinel.message)

    def should_set_message(self):
        self.assertIs(self.consumer.message, sentinel.message)

    def should_call_process_message(self):
        self.consumer.process_message.assert_called_once_with()
示例#3
0
 def should_require_subclasses_to_implement_process_message(self):
     self.assertRaises(NotImplementedError, Consumer().process_message)
示例#4
0
    def setUp(self):
        self.consumer = Consumer()
        self.consumer.process_message = MagicMock()

        self.consumer.process(sentinel.message)
示例#5
0
    def setUp(self):
        self.consumer = Consumer()
        self.consumer.process_message = MagicMock()

        self.consumer.process(sentinel.message)
示例#6
0
 def configure(self):
     self.consumer = Consumer()
     self.broker = Broker()
     self.bindings = [('myqueue', 'myexchange', 'my.routing.key')]