Send all available variable substitutions in TCP
Closes PLAT-2606 Test Plan: - Install an LTI2 tool and verify that the tool consumer profile now contains all variable expansions in the enabled capability section. - Include these capabilities as parameters, do a launch, and verify that the applicable expansions are replaced. Change-Id: Ia97f0184c94eeeb33c5851c715770f209a21c3c2 Reviewed-on: https://gerrit.instructure.com/113014 Reviewed-by: Andrew Butterfield <abutterfield@instructure.com> QA-Review: August Thornton <august@instructure.com> Tested-by: Jenkins Product-Review: Weston Dransfield <wdransfield@instructure.com>
This commit is contained in:
parent
23f9078ec9
commit
233d53dcc0
|
@ -48,30 +48,17 @@ module Lti
|
|||
|
||||
DEFAULT_CAPABILITIES = %w(
|
||||
basic-lti-launch-request
|
||||
User.id
|
||||
Canvas.api.domain
|
||||
LtiLink.custom.url
|
||||
ToolProxyBinding.custom.url
|
||||
ToolProxy.custom.url
|
||||
Canvas.placements.accountNavigation
|
||||
Canvas.placements.courseNavigation
|
||||
Canvas.placements.assignmentSelection
|
||||
Canvas.placements.linkSelection
|
||||
Canvas.placements.postGrades
|
||||
User.username
|
||||
Person.email.primary
|
||||
vnd.Canvas.Person.email.sis
|
||||
Person.name.given
|
||||
Person.name.family
|
||||
Person.name.full
|
||||
CourseSection.sourcedId
|
||||
Person.sourcedId
|
||||
Membership.role
|
||||
ToolConsumerProfile.url
|
||||
Security.splitSecret
|
||||
Context.id
|
||||
Canvas.assignment.id
|
||||
).concat(CapabilitiesHelper::SUPPORTED_CAPABILITIES).freeze
|
||||
).concat(
|
||||
CapabilitiesHelper::SUPPORTED_CAPABILITIES
|
||||
).concat(
|
||||
Lti::VariableExpander.expansion_keys
|
||||
).uniq.freeze
|
||||
|
||||
RESTRICTED_CAPABILITIES = [
|
||||
'Canvas.placements.similarityDetection',
|
||||
|
|
|
@ -40,6 +40,10 @@ module Lti
|
|||
@expansions || {}
|
||||
end
|
||||
|
||||
def self.expansion_keys
|
||||
self.expansions.keys.map { |c| c.to_s[1..-1] }
|
||||
end
|
||||
|
||||
CONTROLLER_GUARD = -> { !!@controller }
|
||||
COURSE_GUARD = -> { @context.is_a? Course }
|
||||
TERM_START_DATE_GUARD = -> { @context.is_a?(Course) && @context.enrollment_term &&
|
||||
|
|
|
@ -121,6 +121,16 @@ module Lti
|
|||
expect(expanded[:some_name]).to eq "my variable is buried in here ${tests_expan} can you find it?"
|
||||
end
|
||||
|
||||
describe '#self.expansion_keys' do
|
||||
let(:expected_keys) do
|
||||
VariableExpander.expansions.keys.map { |c| c.to_s[1..-1] }
|
||||
end
|
||||
|
||||
it 'includes all expansion keys' do
|
||||
expect(VariableExpander.expansion_keys).to eq expected_keys
|
||||
end
|
||||
end
|
||||
|
||||
describe '#enabled_capability_params' do
|
||||
let(:enabled_capability) {
|
||||
%w(TestCapability.Foo
|
||||
|
|
|
@ -117,6 +117,11 @@ module Lti
|
|||
end
|
||||
|
||||
describe '#capabilities' do
|
||||
it 'includes all variable expansions from the variable expander' do
|
||||
expected_caps = VariableExpander.expansion_keys
|
||||
expect(tcp_creator.create.capability_offered).to include(*expected_caps)
|
||||
end
|
||||
|
||||
it 'add the basic_launch capability' do
|
||||
expect(tcp_creator.create.capability_offered).to include 'basic-lti-launch-request'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue