Don't (sis) import observers into blueprint courses
fixes LS-3073 flag = none Test plan: - Create users.csv, courses.csv, and enrollments.csv files to create a user, course, and enroll the user into the course as an observer (or get them from me) - Zip the files and upload them at accounts/id/sis_import - Expect to get this warning - "Observer enrollment for abc not allowed in blueprint course def" - Visit the new course's users page and expect the user to not have been enrolled Change-Id: I51bfefcac73219df21ff0c12a23e3e0a717d451f Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/288739 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Ed Schiebel <eschiebel@instructure.com> QA-Review: Robin Kuss <rkuss@instructure.com> Product-Review: Jackson Howe <jackson.howe@instructure.com>
This commit is contained in:
parent
c3b66a6027
commit
fe9c4d7eb1
|
@ -247,8 +247,8 @@ module SIS
|
|||
next
|
||||
end
|
||||
|
||||
if type == "StudentEnrollment" && MasterCourses::MasterTemplate.is_master_course?(@course)
|
||||
message = "Student enrollment for \"#{enrollment_info.user_id}\" not allowed in blueprint course \"#{@course.sis_course_id}\""
|
||||
if %w[StudentEnrollment ObserverEnrollment].include?(type) && MasterCourses::MasterTemplate.is_master_course?(@course)
|
||||
message = "#{type == "StudentEnrollment" ? "Student" : "Observer"} enrollment for \"#{enrollment_info.user_id}\" not allowed in blueprint course \"#{@course.sis_course_id}\""
|
||||
@messages << SisBatch.build_error(enrollment_info.csv, message, sis_batch: @batch, row: enrollment_info.lineno, row_info: enrollment_info.row_info)
|
||||
next
|
||||
end
|
||||
|
|
|
@ -1217,4 +1217,19 @@ describe SIS::CSV::EnrollmentImporter do
|
|||
expect(@student.enrollments.size).to eq 0
|
||||
expect(importer.errors.map(&:last)).to eq ["Student enrollment for \"dee\" not allowed in blueprint course \"blue\""]
|
||||
end
|
||||
|
||||
it "does not enroll observers in blueprint courses" do
|
||||
course_factory(account: @account, sis_source_id: "blue")
|
||||
@teacher = user_with_managed_pseudonym(account: @account, sis_user_id: "daba")
|
||||
@observer = user_with_managed_pseudonym(account: @account, sis_user_id: "dee")
|
||||
MasterCourses::MasterTemplate.set_as_master_course(@course)
|
||||
importer = process_csv_data(
|
||||
"course_id,user_id,role,section_id,status,associated_user_id",
|
||||
"blue,daba,teacher,,active,",
|
||||
"blue,dee,observer,,active,"
|
||||
)
|
||||
expect(@teacher.enrollments.size).to eq 1
|
||||
expect(@observer.enrollments.size).to eq 0
|
||||
expect(importer.errors.map(&:last)).to eq ["Observer enrollment for \"dee\" not allowed in blueprint course \"blue\""]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue