fix presentation_return_url to include the host
fixed PLAT-1114 test-plan: do an lti launch from an assignment, and module. the launch_presentation_return_url should always have a full url Change-Id: I6ed257310181d24d5c9f0f2261aebe2781062fa9 Reviewed-on: https://gerrit.instructure.com/55970 Tested-by: Jenkins Reviewed-by: Brad Humphrey <brad@instructure.com> QA-Review: August Thornton <august@instructure.com> Product-Review: Nathan Mills <nathanm@instructure.com>
This commit is contained in:
parent
664d5da2ca
commit
46fda20135
|
@ -1260,7 +1260,7 @@ class ApplicationController < ActionController::Base
|
|||
@return_url = success_url
|
||||
else
|
||||
if @context
|
||||
@return_url = named_context_url(@context, :context_external_content_success_url, 'external_tool_redirect')
|
||||
@return_url = named_context_url(@context, :context_external_content_success_url, 'external_tool_redirect', include_host: true)
|
||||
else
|
||||
@return_url = external_content_success_url('external_tool_redirect')
|
||||
end
|
||||
|
|
|
@ -512,6 +512,40 @@ describe ApplicationController do
|
|||
controller.stubs(:redirect_to)
|
||||
controller.send(:content_tag_redirect, Account.default, tag, nil)
|
||||
end
|
||||
|
||||
context 'ContextExternalTool' do
|
||||
|
||||
let(:course){ course_model }
|
||||
|
||||
let(:tool) do
|
||||
tool = course.context_external_tools.new(
|
||||
name: "bob",
|
||||
consumer_key: "bob",
|
||||
shared_secret: "bob",
|
||||
tool_id: 'some_tool',
|
||||
privacy_level: 'public'
|
||||
)
|
||||
tool.url = "http://www.example.com/basic_lti"
|
||||
tool.resource_selection = {
|
||||
:url => "http://#{HostUrl.default_host}/selection_test",
|
||||
:selection_width => 400,
|
||||
:selection_height => 400}
|
||||
tool.save!
|
||||
tool
|
||||
end
|
||||
|
||||
let(:content_tag) { ContentTag.create(content: tool, url: tool.url)}
|
||||
|
||||
it 'returns the full path for the redirect url' do
|
||||
controller.expects(:named_context_url).with(course, :context_url, {:include_host => true})
|
||||
controller.expects(:named_context_url).with(course, :context_external_content_success_url, 'external_tool_redirect', {:include_host => true}).returns('wrong_url')
|
||||
controller.stubs(:render)
|
||||
controller.stubs(js_env:[])
|
||||
controller.instance_variable_set(:"@context", course)
|
||||
controller.send(:content_tag_redirect, course, content_tag, nil)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'external_tools_display_hashes' do
|
||||
|
|
|
@ -42,7 +42,7 @@ describe "External Tools" do
|
|||
expect(form.at_css('input#launch_presentation_locale')['value']).to eq 'en'
|
||||
expect(form.at_css('input#oauth_callback')['value']).to eq 'about:blank'
|
||||
expect(form.at_css('input#oauth_signature_method')['value']).to eq 'HMAC-SHA1'
|
||||
expect(form.at_css('input#launch_presentation_return_url')['value']).to eq "/courses/#{@course.id}/external_content/success/external_tool_redirect"
|
||||
expect(form.at_css('input#launch_presentation_return_url')['value']).to eq "http://www.example.com/courses/#{@course.id}/external_content/success/external_tool_redirect"
|
||||
expect(form.at_css('input#lti_message_type')['value']).to eq "basic-lti-launch-request"
|
||||
expect(form.at_css('input#lti_version')['value']).to eq "LTI-1p0"
|
||||
expect(form.at_css('input#oauth_version')['value']).to eq "1.0"
|
||||
|
|
Loading…
Reference in New Issue