Ejemplo n.º 1
0
    def test_channel_consume_exception_when_recoverable(self):
        connection = amqpstorm.Connection('localhost', 'guest', 'guest',
                                          lazy=True)
        connection.set_state(connection.OPEN)
        channel = Channel(0, connection, 360)
        channel.set_state(channel.OPEN)
        channel.exceptions.append(AMQPChannelError('no-route'))

        self.assertTrue(connection.is_open)
        self.assertTrue(channel.is_open)

        self.assertRaisesRegexp(exception.AMQPChannelError, 'no-route',
                                channel.check_for_errors)

        self.assertTrue(channel.is_open)

        channel.check_for_errors()
Ejemplo n.º 2
0
    def test_channel_consume_exception_when_recoverable(self):
        connection = amqpstorm.Connection('localhost',
                                          'guest',
                                          'guest',
                                          lazy=True)
        connection.set_state(connection.OPEN)
        channel = Channel(0, connection, 360)
        channel.set_state(channel.OPEN)
        channel.exceptions.append(AMQPChannelError('no-route'))

        self.assertTrue(connection.is_open)
        self.assertTrue(channel.is_open)

        self.assertRaisesRegexp(exception.AMQPChannelError, 'no-route',
                                channel.check_for_errors)

        self.assertTrue(channel.is_open)

        channel.check_for_errors()
Ejemplo n.º 3
0
 def test_channel_check_error_no_exception(self):
     channel = Channel(0, FakeConnection(), 360)
     channel.set_state(Channel.OPEN)
     self.assertIsNone(channel.check_for_errors())
 def test_channel_check_error_no_exception(self):
     channel = Channel(0, FakeConnection(), 360)
     channel.set_state(Channel.OPEN)
     self.assertIsNone(channel.check_for_errors())