コード例 #1
0
ファイル: channel0_tests.py プロジェクト: exg77/amqpstorm
    def test_channel0_close_connection(self):
        connection = FakeConnection()
        connection.set_state(connection.OPEN)
        channel = Channel0(connection)

        self.assertTrue(connection.is_open)
        channel._close_connection(
            Connection.Close(reply_text=b'', reply_code=200))
        self.assertEqual(connection.exceptions, [])
        self.assertTrue(connection.is_closed)
コード例 #2
0
ファイル: channel0_tests.py プロジェクト: exg77/amqpstorm
 def test_channel0_forcefully_closed_connection(self):
     connection = amqpstorm.Connection('localhost',
                                       'guest',
                                       'guest',
                                       lazy=True)
     connection.set_state(connection.OPEN)
     channel = Channel0(connection)
     channel._close_connection(
         Connection.Close(reply_text=b'', reply_code=500))
     self.assertTrue(connection.is_closed)
     self.assertRaises(AMQPConnectionError, connection.check_for_errors)
コード例 #3
0
    def test_channel0_on_close_frame(self):
        self.connection.set_state(self.connection.OPEN)
        channel = Channel0(self.connection)

        self.assertFalse(self.connection.exceptions)

        channel.on_frame(Connection.Close())

        self.assertTrue(self.connection.exceptions)
        self.assertTrue(self.connection.is_closed)
        self.assertRaisesRegexp(
            AMQPConnectionError,
            'Connection was closed by remote server: ',
            self.connection.check_for_errors
        )
コード例 #4
0
    def test_channel0_on_close_frame(self):
        connection = amqpstorm.Connection('localhost',
                                          'guest',
                                          'guest',
                                          lazy=True)
        connection.set_state(connection.OPEN)
        channel = Channel0(connection)

        self.assertFalse(connection.exceptions)

        channel.on_frame(Connection.Close())

        self.assertTrue(connection.exceptions)
        self.assertTrue(connection.is_closed)
        self.assertRaisesRegexp(AMQPConnectionError,
                                'Connection was closed by remote server: ',
                                connection.check_for_errors)