예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
파일: test_channel.py 프로젝트: ooici/pyon
    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)
예제 #4
0
    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)
예제 #5
0
    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')
예제 #6
0
    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')
예제 #7
0
파일: test_channel.py 프로젝트: ooici/pyon
    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')
예제 #8
0
    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')
예제 #9
0
    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')
예제 #10
0
    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)
예제 #11
0
파일: test_channel.py 프로젝트: ooici/pyon
    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)
예제 #12
0
    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)