Example #1
0
 def test_forcefully_closed_connection(self):
     connection = FakeConnection()
     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)
Example #2
0
    def test_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)