def METHOD_NAME(
    self,
    views,
    pyramid_request,
    application_instance,
    application_instance_service,
    lti_registration_service,
):
    lti_registration = factories.LTIRegistration()
    lti_registration_service.get_by_id.return_value = lti_registration
    assert not application_instance.lti_registration
    response = views.upgrade_instance_callback()
    application_instance_service.get_by_consumer_key.assert_called_once_with(
        application_instance.consumer_key
    )
    assert application_instance.lti_registration == lti_registration
    assert (
        application_instance.deployment_id
        == pyramid_request.params["deployment_id"]
    )
    assert response == temporary_redirect_to(
        pyramid_request.route_url("admin.instance", id_=application_instance.id)
    )