set default value to optional argument

refs PLAT-2647

test plan:
• using an lti2 JWT
• create several hundred subscriptions
• do a GET request to /api/lti/subscriptions
• expect to see a list of subscriptions up to the default limit of
  100 per result set
• look for an 'EndKey' header and put that value in your next request
  as a header field called `StartKey`
• repeat this process until you have fetched all pages

Change-Id: I74c4029a245716a1f4bc6648348f52426d447e9b
Reviewed-on: https://gerrit.instructure.com/116795
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Product-Review: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
This commit is contained in:
August Thornton 2017-06-23 13:04:43 -06:00
parent 6e7aae4047
commit 0cbc08777d
2 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ module Services
request(:get, "/api/subscriptions/#{subscription_id}", options)
end
def tool_proxy_subscriptions(tool_proxy, optional_headers)
def tool_proxy_subscriptions(tool_proxy, optional_headers = {})
options = { headers: headers(tool_proxy_jwt_body(tool_proxy), optional_headers) }
request(:get, '/api/subscriptions', options)
end

View File

@ -162,7 +162,7 @@ module Services
expect(jwt["RootAccountUUID"]).to eq('random-account-uuid')
expect(jwt["sub"]).to eq('ltiToolProxy:151b52cd-d670-49fb-bf65-6a327e3aaca0')
end
LiveEventsSubscriptionService.tool_proxy_subscriptions(tool_proxy, {})
LiveEventsSubscriptionService.tool_proxy_subscriptions(tool_proxy)
end
end
@ -215,7 +215,7 @@ module Services
tool_proxy.stubs(:context).returns(root_account_context)
root_account_context.stubs(:root_account).returns(root_account_object)
Timeout.expects(:timeout).raises(Timeout::Error)
expect { LiveEventsSubscriptionService.tool_proxy_subscriptions(tool_proxy, {}) }.to raise_error(Timeout::Error)
expect { LiveEventsSubscriptionService.tool_proxy_subscriptions(tool_proxy) }.to raise_error(Timeout::Error)
end
end
end