respondus: link assignment to quiz correctly

fixes CNVS-8915

test plan:
- use the respondus quiz builder tool to create a quiz
- in the settings tab, check 'publish now'
- export the quiz to canvas
- take the quiz as a student
- the score you get should show up in the gradebook

Change-Id: I36dd1046b1ee1b82a7ad4bafac2a7e53dd309b59
Reviewed-on: https://gerrit.instructure.com/32617
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Simon Williams 2014-03-31 14:24:44 -06:00
parent 0fa0a3dce5
commit b9d3460aaa
2 changed files with 46 additions and 48 deletions

View File

@ -23,6 +23,7 @@ class RespondusSettings
assessment[:available] = true assessment[:available] = true
assessment[:assignment] = { assessment[:assignment] = {
:title => assessment[:title], :title => assessment[:title],
:submission_types => "online_quiz"
} }
end end

View File

@ -37,10 +37,11 @@ describe Qti::Converter do
quiz.assignment.should be_nil quiz.assignment.should be_nil
end end
it "should publish as assignment on import if specified" do describe "applying respondus settings" do
copy = Tempfile.new(['spec-canvas', '.zip']) before do
FileUtils.cp(fname, copy.path) @copy = Tempfile.new(['spec-canvas', '.zip'])
Zip::File.open(copy.path) do |zf| FileUtils.cp(fname, @copy.path)
Zip::File.open(@copy.path) do |zf|
zf.file.open("settings.xml", 'w') do |f| zf.file.open("settings.xml", 'w') do |f|
f.write <<-XML f.write <<-XML
<settings> <settings>
@ -50,9 +51,12 @@ describe Qti::Converter do
XML XML
end end
end end
setup_migration(copy.path) setup_migration(@copy.path)
@migration.update_migration_settings(:apply_respondus_settings_file => true) @migration.update_migration_settings(:apply_respondus_settings_file => true)
@migration.save! @migration.save!
end
it "should publish as assignment on import if specified" do
do_migration do_migration
quiz = @course.quizzes.last quiz = @course.quizzes.last
@ -63,24 +67,9 @@ describe Qti::Converter do
end end
it "should re-use the same assignment on update" do it "should re-use the same assignment on update" do
copy = Tempfile.new(['spec-canvas', '.zip'])
FileUtils.cp(fname, copy.path)
Zip::File.open(copy.path) do |zf|
zf.file.open("settings.xml", 'w') do |f|
f.write <<-XML
<settings>
<setting name='hasSettings'>true</setting>
<setting name='publishNow'>true</setting>
</settings>
XML
end
end
setup_migration(copy.path)
@migration.update_migration_settings(:apply_respondus_settings_file => true)
@migration.save!
do_migration do_migration
setup_migration(copy.path) setup_migration(@copy.path)
@migration.update_migration_settings(:apply_respondus_settings_file => true, :quiz_id_to_update => @course.quizzes.last.id) @migration.update_migration_settings(:apply_respondus_settings_file => true, :quiz_id_to_update => @course.quizzes.last.id)
@migration.save! @migration.save!
do_migration do_migration
@ -94,6 +83,14 @@ describe Qti::Converter do
quiz.assignment.should be_published quiz.assignment.should be_published
end end
it "should correctly set the assignment submission_type" do
do_migration
assign = @course.assignments.last
assign.submission_types.should == 'online_quiz'
assign.quiz.for_assignment?.should be_true
end
end
it "should publish spec-canvas-1 correctly" do it "should publish spec-canvas-1 correctly" do
setup_migration setup_migration
do_migration do_migration