diff --git a/app/models/exporters/quizzes2_exporter.rb b/app/models/exporters/quizzes2_exporter.rb index e76a9cc9214..ff51fef9e27 100644 --- a/app/models/exporters/quizzes2_exporter.rb +++ b/app/models/exporters/quizzes2_exporter.rb @@ -25,9 +25,7 @@ module Exporters external_tool_tag, @assignment.shard ), title: @quiz.title, - context_title: @quiz.context.name, - context_type: 'external_url', - context_id: @quiz.context_id + context_title: @quiz.context.name } } end diff --git a/lib/canvas/live_events.rb b/lib/canvas/live_events.rb index fbd54084b62..c938e3ca332 100644 --- a/lib/canvas/live_events.rb +++ b/lib/canvas/live_events.rb @@ -385,6 +385,6 @@ module Canvas::LiveEvents def self.quiz_export_complete(content_export) payload = content_export.settings[:quizzes2] - post_event_stringified('quiz_export_complete', payload) + post_event_stringified('quiz_export_complete', payload, amended_context(content_export.context)) end end diff --git a/spec/lib/canvas/live_events_spec.rb b/spec/lib/canvas/live_events_spec.rb index 20ee031b408..e86c01f877f 100644 --- a/spec/lib/canvas/live_events_spec.rb +++ b/spec/lib/canvas/live_events_spec.rb @@ -459,4 +459,43 @@ describe Canvas::LiveEvents do Canvas::LiveEvents.assignment_updated(assignment) end end + + describe '.quiz_export_complete' do + class FakeExport + attr_accessor :context + + def initialize(context) + @context = context + end + + def settings + { + quizzes2: { + key1: 'val1', + key2: 'val2' + } + } + end + end + + let(:content_export) { FakeExport.new(course_model) } + + it 'triggers a live event with content export settings and amended context details' do + fake_export_context = {key1: 'val1', key2: 'val2'} + + expect_event( + 'quiz_export_complete', + fake_export_context, + hash_including({ + :context_type => "Course", + :context_id => content_export.context.id, + :root_account_id => content_export.context.root_account.global_id, + :root_account_uuid => content_export.context.root_account.uuid, + :root_account_lti_guid => content_export.context.root_account.lti_guid, + }) + ).once + + Canvas::LiveEvents.quiz_export_complete(content_export) + end + end end