def test_on_channel_close(self): ch = BaseChannel() ch._amq_chan = Mock() ch._amq_chan.channel_number = 1 ch.on_channel_close(0, 'hi') self.assertIsNone(ch._amq_chan)
def test_on_channel_close(self): ch = BaseChannel() ch.on_channel_open(Mock()) ch._transport.channel_number = 1 ch.on_channel_close(ch, 0, 'hi') self.assertIsNone(ch._transport)
def test_on_channel_close(self): # er this just does logging, make the calls anyway for coverage. ch = BaseChannel() ch._amq_chan = Mock() ch._amq_chan.channel_number = 1 ch.on_channel_close(0, 'hi') ch.on_channel_close(1, 'onoes')
def test_on_channel_closed_with_error_callback(self): ch = BaseChannel() ch._amq_chan = Mock() ch._amq_chan.channel_number = 1 closemock = Mock() ch.set_closed_error_callback(closemock) ch.on_channel_close(1, 'hi') closemock.assert_called_once_with(ch, 1, 'hi')
def test_on_channel_closed_with_error_callback(self): ch = BaseChannel() ch.on_channel_open(Mock()) ch._transport.channel_number = 1 closemock = Mock() ch.set_closed_error_callback(closemock) ch.on_channel_close(ch, 1, 'hi') closemock.assert_called_once_with(ch, 1, 'hi')
def test_on_channel_close_with_error_in_error_callback(self, logmock): ch = BaseChannel() ch._amq_chan = Mock() ch._amq_chan.channel_number = 1 closemock = Mock() closemock.side_effect = StandardError ch.set_closed_error_callback(closemock) ch.on_channel_close(1, 'hi') self.assertEquals(logmock.warn.call_count, 1)
def test_on_channel_close_with_error_in_error_callback(self, logmock): ch = BaseChannel() ch.on_channel_open(Mock()) ch._transport.channel_number = 1 closemock = Mock() closemock.side_effect = StandardError ch.set_closed_error_callback(closemock) ch.on_channel_close(ch, 1, 'hi') self.assertEquals(logmock.warn.call_count, 1)
def test_on_channel_close_with_error_in_error_callback(self, logmock): ch = BaseChannel() ch._amq_chan = Mock() ch._amq_chan.channel_number = 1 closemock = Mock() closemock.side_effect = StandardError ch.set_closed_error_callback(closemock) ch.on_channel_close(1, "hi") self.assertEquals(logmock.warn.call_count, 1)