'_on_terminate invokes `Connection.ON_CONNECTION_CLOSED` callbacks'

def test_on_terminate_invokes_connection_closed_callback(self):

    self.connection.callbacks.process = mock.Mock(wraps=self.connection.callbacks.process)
    self.connection._adapter_disconnect = mock.Mock()
    self.connection._on_terminate(1, 'error    text')
    self.connection.callbacks.process.assert_called_once_with(0, self.connection.ON_CONNECTION_CLOSED, self.connection, self.connection, 1, 'error    text')
    with self.assertRaises(AssertionError):
        self.connection.callbacks.process.assert_any_call(0, self.connection.ON_CONNECTION_ERROR, self.connection, self.connection, mock.ANY)
