encode available_canvas_resources variable as JSON

test plan:
* testing with the new index placement tools
 on the assignments/modules page should send
 the available canvas resources encoded
 as a JSON string so the oauth signature works

Change-Id: I329c819a17ca70b84a5d165964246af6e635dacb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/218523
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Carl Kibler <ckibler@instructure.com>
QA-Review: Carl Kibler <ckibler@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
James Williams 2019-11-25 09:21:24 -07:00
parent fdce70ac1d
commit ba7f83d080
2 changed files with 4 additions and 4 deletions

View File

@ -1346,16 +1346,16 @@ module Lti
-> { @request.parameters['com_instructure_course_allow_canvas_resource_selection'] }, -> { @request.parameters['com_instructure_course_allow_canvas_resource_selection'] },
default_name: 'com_instructure_course_allow_canvas_resource_selection' default_name: 'com_instructure_course_allow_canvas_resource_selection'
# Returns a list of content groups which can be selected, providing ID and name of each group, # Returns a JSON-encoded list of content groups which can be selected, providing ID and name of each group,
# forwarded from the request. # forwarded from the request.
# Empty value if com.instructure.Course.allow_canvas_resource_selection is false. # Empty value if com.instructure.Course.allow_canvas_resource_selection is false.
# #
# @example # @example
# ``` # ```
# [{"id": "3", name: "First Module"}, {"id": "5", name: "Second Module"] # [{"id":"3","name":"First Module"},{"id":"5","name":"Second Module"}]
# ``` # ```
register_expansion 'com.instructure.Course.available_canvas_resources', [], register_expansion 'com.instructure.Course.available_canvas_resources', [],
-> { @request.parameters['com_instructure_course_available_canvas_resources'] }, -> { @request.parameters['com_instructure_course_available_canvas_resources']&.to_json },
default_name: 'com_instructure_course_available_canvas_resources' default_name: 'com_instructure_course_available_canvas_resources'
private private

View File

@ -693,7 +693,7 @@ module Lti
it 'has substitution for $com.instructure.Course.available_canvas_resources' do it 'has substitution for $com.instructure.Course.available_canvas_resources' do
exp_hash = {test: '$com.instructure.Course.available_canvas_resources'} exp_hash = {test: '$com.instructure.Course.available_canvas_resources'}
variable_expander.expand_variables!(exp_hash) variable_expander.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq [{"id"=>"1", "name"=>"item 1"}, {"id"=>"2", "name"=>"item 2"}] expect(JSON.parse(exp_hash[:test])).to eq [{"id"=>"1", "name"=>"item 1"}, {"id"=>"2", "name"=>"item 2"}]
end end
context 'context is a group' do context 'context is a group' do