From 5f620b114a51cfc7a91ee24db80b4684bbac4645 Mon Sep 17 00:00:00 2001 From: Nathan Mills Date: Mon, 1 Dec 2014 16:24:01 -0700 Subject: [PATCH] the tool consumer profile includes the service_owner object fixes: PLAT-789 test-plan specs should pass Change-Id: I81438bbe156248d84622316f98d1e2cb81751828 Reviewed-on: https://gerrit.instructure.com/45073 Tested-by: Jenkins Reviewed-by: Brad Humphrey Product-Review: Nathan Mills QA-Review: Nathan Mills --- app/models/lti/tool_consumer_profile_creator.rb | 8 ++++++++ .../models/lti/tool_consumer_profile_creator_spec.rb | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/models/lti/tool_consumer_profile_creator.rb b/app/models/lti/tool_consumer_profile_creator.rb index f79ea2163e4..28fdc1444c6 100644 --- a/app/models/lti/tool_consumer_profile_creator.rb +++ b/app/models/lti/tool_consumer_profile_creator.rb @@ -83,6 +83,7 @@ module Lti product_instance = IMS::LTI::Models::ProductInstance.new product_instance.guid = @root_account.lti_guid product_instance.product_info = create_product_info + product_instance.service_owner = create_service_owner product_instance end @@ -109,6 +110,13 @@ module Lti vendor end + def create_service_owner + service_owner = IMS::LTI::Models::ServiceOwner.new + service_owner.create_service_owner_name(@root_account.name) + service_owner.create_description(@root_account.name) + service_owner + end + def services endpoint_slug = "#{@scheme}://#{@domain}/" SERVICES.map do |service| diff --git a/spec/models/lti/tool_consumer_profile_creator_spec.rb b/spec/models/lti/tool_consumer_profile_creator_spec.rb index 586e6d54fba..37b683d9b76 100644 --- a/spec/models/lti/tool_consumer_profile_creator_spec.rb +++ b/spec/models/lti/tool_consumer_profile_creator_spec.rb @@ -3,7 +3,12 @@ require 'spec_helper' module Lti describe ToolConsumerProfileCreator do - let(:root_account) { mock('root account', lti_guid: 'my_guid') } + let(:root_account) do + mock('root account') do + stubs(:lti_guid).returns('my_guid') + stubs(:name).returns('root_account_name') + end + end let(:account) { mock('account', id: 3, root_account: root_account) } let(:tcp_url) { 'http://example.instructure.com/tcp/uuid' } subject { ToolConsumerProfileCreator.new(account, tcp_url) } @@ -21,7 +26,12 @@ module Lti product_instance = subject.create.product_instance expect(product_instance.guid).to eq 'my_guid' expect(product_instance.product_info).to be_an IMS::LTI::Models::ProductInfo + end + it 'creates the service owner' do + service_owner = subject.create.product_instance.service_owner + expect(service_owner.service_owner_name.default_value).to eq 'root_account_name' + expect(service_owner.description.default_value).to eq 'root_account_name' end it 'creates the product info' do