Fixup content_export_complete LiveEvent metadata/body
Fixes: QUIZ-1478 Move the context_type/id to the attributes Tack on amended_context to the payload Test-Plan: o With live events set up for local testing - Assert that the quiz_export_complete event looks right - It should contain uuid/root_account_id/and everything else in the attributes - It should not contain context_type/id in the body Change-Id: I15387ce81f6d0ed8a7c72831d08b34c1bc40221e Reviewed-on: https://gerrit.instructure.com/106811 Reviewed-by: Simon Williams <simon@instructure.com> Tested-by: Jenkins QA-Review: Dariusz Dzien <ddzien@instructure.com> Product-Review: Jayce Higgins <jhiggins@instructure.com>
This commit is contained in:
parent
0cdbb52731
commit
04d1801679
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue