include assignments for graded objects in external export

closes #CNVS-35995

Change-Id: Icdea27f8ea3b3ad09393bfdbe5ba369e529e8a2d
Reviewed-on: https://gerrit.instructure.com/107034
Tested-by: Jenkins
Reviewed-by: Christian Prescott <cprescott@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
James Williams 2017-03-30 14:51:56 -06:00
parent f0f0e7f5ec
commit deecb1ee18
2 changed files with 11 additions and 1 deletions

View File

@ -375,6 +375,9 @@ class ContentExport < ActiveRecord::Base
# for integrating selective exports with external content
if (type = Canvas::Migration::ExternalContent::Translator::CLASSES_TO_TYPES[obj.class])
exported_assets << "#{type}_#{obj.id}"
if obj.respond_to?(:for_assignment?) && obj.for_assignment?
exported_assets << "assignment_#{obj.assignment_id}"
end
end
end

View File

@ -115,8 +115,14 @@ describe ContentMigration do
it "should send a list of exported assets to the external service when selectively exporting" do
assmt = @copy_from.assignments.create!
other_assmt = @copy_from.assignments.create!
graded_quiz = @copy_from.quizzes.create!
graded_quiz.generate_quiz_data
graded_quiz.workflow_state = 'available'
graded_quiz.save!
cm = @copy_from.context_modules.create!(:name => "some module")
item = cm.add_item(:id => assmt.id, :type => 'assignment')
item2 = cm.add_item(:id => graded_quiz.id, :type => 'quiz')
TestExternalContentService.stubs(:applies_to_course?).returns(true)
TestExternalContentService.stubs(:export_completed?).returns(true)
@ -126,7 +132,8 @@ describe ContentMigration do
@cm.save!
TestExternalContentService.expects(:begin_export).with(@copy_from,
{:selective => true, :exported_assets => ["context_module_#{cm.id}", "assignment_#{assmt.id}"]})
{:selective => true, :exported_assets =>
["context_module_#{cm.id}", "assignment_#{assmt.id}", "quiz_#{graded_quiz.id}", "assignment_#{graded_quiz.assignment.id}"]})
run_course_copy
end