def test_set_channel_assigns_to_channel(self): obj = consumer.Consumer({}, None) channel = mock.Mock() obj._set_channel(channel) self.assertEqual(obj._channel, channel)
def test_initialize_is_invoked(self): with mock.patch('rejected.consumer.Consumer.initialize') as init: consumer.Consumer({}, None) init.assert_called_once_with()
def test_process_raises_exception(self): obj = consumer.Consumer({}, None) self.assertRaises(NotImplementedError, obj.process)
def test_channel_is_none(self): obj = consumer.Consumer({}, None) self.assertIsNone(obj._channel)
def test_message_is_none(self): obj = consumer.Consumer({}, None) self.assertIsNone(obj._message)
def test_configuration_is_assigned(self): cfg = {'foo': 'bar'} obj = consumer.Consumer(cfg, None) self.assertDictEqual(obj._settings, cfg)
def test_set_channel_assigns_to_channel(self): obj = consumer.Consumer(settings={}, process=None) conn = mock.Mock(spec=connection.Connection) conn.name = 'mock' obj.set_connection(conn) self.assertEqual(obj._connections['mock'], conn)
def test_initialize_is_invoked(): with mock.patch('rejected.consumer.Consumer.initialize') as init: consumer.Consumer(settings={}, process=None) init.assert_called_once_with()
def test_message_is_none(self): obj = consumer.Consumer(settings={}, process=None) self.assertIsNone(obj._message)
def test_channel_is_none(self): obj = consumer.Consumer(settings={}, process=None) self.assertIsNone(obj._channel)