Here are the examples of the python api mock.sentinel.channel_number taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
Example 1
def test_ack(self):
transport = Mock()
transport.channel_number = sentinel.channel_number
self.ch.on_channel_open(transport)
self.ch.ack(sentinel.delivery_tag)
transport.ack_impl.assert_called_once_with(sentinel.delivery_tag)
3
Example 2
def test_reject(self):
transport = Mock()
transport.channel_number = sentinel.channel_number
self.ch.on_channel_open(transport)
self.ch.reject(sentinel.delivery_tag, requeue=True)
transport.reject_impl.assert_called_once_with(sentinel.delivery_tag, requeue=True)
0
Example 3
Project: pyon Source File: test_channel.py
def test__send(self):
transport = Mock()
transport.channel_number = sentinel.channel_number
self.ch.on_channel_open(transport)
# test sending in params
self.ch._send(NameTrio('xp', 'namen'), 'daten')
# get our props
self.assertTrue(transport.publish_impl.called)
self.assertIn('exchange', transport.publish_impl.call_args[1])
self.assertIn('routing_key', transport.publish_impl.call_args[1])
self.assertIn('body', transport.publish_impl.call_args[1])
self.assertIn('immediate', transport.publish_impl.call_args[1])
self.assertIn('mandatory', transport.publish_impl.call_args[1])
self.assertIn('properties', transport.publish_impl.call_args[1])
props = transport.publish_impl.call_args[1].get('properties')
self.assertEquals(props, {})
# try another call to _send with a header
self.ch._send(NameTrio('xp', 'namen'), 'daten', headers={'custom':'val'})
# make sure our property showed up
props = transport.publish_impl.call_args[1].get('properties')
self.assertIn('custom', props)
self.assertEquals(props['custom'], 'val')