'_on_terminate cleans up heartbeat, adapter, and channels'

def test_on_terminate_cleans_up(self):

    heartbeat = mock.Mock()
    self.connection.heartbeat = heartbeat
    self.connection._adapter_disconnect = mock.Mock()
    self.connection._on_terminate((-1), 'Undefined')
    heartbeat.stop.assert_called_once_with()
    self.connection._adapter_disconnect.assert_called_once_with()
    self.channel._on_close_meta.assert_called_once_with((-1), 'Undefined')
    self.assertTrue(self.connection.is_closed)
