def METHOD_NAME(
    self, views, db_session, lti_registration_service
):
    lti_registration = factories.LTIRegistration()
    lti_registration_service.get_by_id.return_value = lti_registration
    factories.ApplicationInstance(
        lti_registration=lti_registration, deployment_id="DEPLOYMENT_ID"
    )
    response = views.upgrade_instance_callback()
    assert response == REDIRECT_TO_UPGRADE_AI
    # Show that the DB connection has not been permanently broken. This
    # would cause us to fail completely when trying to present the error.
    # We are checking we do _not_ raise `PendingRollbackError` here.
    db_session.query(ApplicationInstance).all()