Refactor LTI parameters and add study group

* This change also requires that submissions in our test need to have a valid study group.
This commit is contained in:
Sebastian Serth
2023-08-19 11:28:57 +02:00
committed by Sebastian Serth
parent e2baa2ee55
commit e3603758ef
18 changed files with 114 additions and 54 deletions

View File

@ -8,12 +8,18 @@ FactoryBot.define do
}.freeze
factory :lti_parameter do
consumer
exercise factory: :math
external_user
lti_parameters { lti_params }
after(:create) do |lti_parameter|
# Do not change anything if a study group was provided explicitly or user has no study groups
next if lti_parameter.study_group.present? || lti_parameter.external_user.study_groups.blank?
lti_parameter.update!(study_group: lti_parameter.external_user.study_groups.first)
end
trait :without_outcome_service_url do
lti_parameters { lti_params.except(:lis_outcome_service_url) }
end