lti2 cert fixes

refs PLAT-2640

test plan:
we should be able to pass certification

Change-Id: I4508af544e1dcacec42180d96865e7ef841c8ff8
Reviewed-on: https://gerrit.instructure.com/116171
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
This commit is contained in:
Nathan Mills 2017-06-20 13:48:02 -06:00
parent 9011b00812
commit 31acbd956a
3 changed files with 19 additions and 2 deletions

View File

@ -20,7 +20,7 @@ module Lti
belongs_to :developer_key
before_validation { self.uuid ||= SecureRandom.uuid }
before_validation {self.uuid ||= SecureRandom.uuid}
after_update :clear_cache
serialize :services
@ -46,12 +46,14 @@ module Lti
DEFAULT_CAPABILITIES = %w(
basic-lti-launch-request
ToolProxyRegistrationRequest
Canvas.placements.accountNavigation
Canvas.placements.courseNavigation
Canvas.placements.assignmentSelection
Canvas.placements.linkSelection
Canvas.placements.postGrades
Security.splitSecret
Context.sourcedId
).concat(
CapabilitiesHelper::SUPPORTED_CAPABILITIES
).concat(

View File

@ -128,6 +128,14 @@ module Lti
-> { Lti::Asset.opaque_identifier_for(@context) },
default_name: 'context_id'
# The sourced Id of the context.
# @example
# ```
# 1234
# ```
register_expansion 'Context.sourcedId', [],
-> { @context.sis_source_id }
# communicates the kind of browser window/frame where the Canvas has launched a tool
# @launch_parameter launch_presentation_document_target
# @example
@ -881,7 +889,7 @@ module Lti
# https://<domain>.instructure.com/api/lti/accounts/<account_id>/tool_consumer_profile/<opaque_id>
# ```
register_expansion 'ToolConsumerProfile.url', [],
-> { @controller.polymorphic_url([@tool.context, :tool_consumer_profile], tool_consumer_profile_id: Lti::ToolConsumerProfile::DEFAULT_TCP_UUID)},
-> { @controller.polymorphic_url([@tool.context, :tool_consumer_profile])},
CONTROLLER_GUARD,
-> { @tool && @tool.is_a?(Lti::ToolProxy) }

View File

@ -419,6 +419,13 @@ module Lti
expect(exp_hash[:test]).to eq 123
end
it 'has substitution for $Context.sourcedId' do
course.stubs(:sis_source_id).returns('123')
exp_hash = {test: '$Context.sourcedId'}
variable_expander.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq '123'
end
it 'has substitution for $vnd.instructure.Course.uuid' do
course.stubs(:uuid).returns('Ioe3sJPt0KZp9Pw6xAvcHuLCl0z4TvPKP0iIOLbo')
exp_hash = {test: '$vnd.instructure.Course.uuid'}