diaspora/spec/integration/api/user_info_controller_spec.rb
theworldbright a76f51a6a5 Use redirect_uri if no sector identifier for ppid
As according to http://openid.net/specs/openid-connect-core-1_0.html#PairwiseAlg:

"If the Client has not provided a value for
sector_identifier_uri in Dynamic Client Registration
[OpenID.Registration], the Sector Identifier used
for pairwise identifier calculation is the host
component of the registered redirect_uri."
2016-01-04 16:49:55 +09:00

21 lines
842 B
Ruby

require "spec_helper"
describe Api::OpenidConnect::UserInfoController do
let!(:auth_with_read_and_ppid) { FactoryGirl.create(:auth_with_read_and_ppid) }
let!(:access_token_with_read) { auth_with_read_and_ppid.create_access_token.to_s }
describe "#show" do
before do
@user = auth_with_read_and_ppid.user
get api_openid_connect_user_info_path, access_token: access_token_with_read
end
it "shows the info" do
json_body = JSON.parse(response.body)
expected_sub =
@user.pairwise_pseudonymous_identifiers.find_or_create_by(identifier: "https://example.com/uri").guid
expect(json_body["sub"]).to eq(expected_sub)
expect(json_body["nickname"]).to eq(@user.name)
expect(json_body["profile"]).to eq(File.join(AppConfig.environment.url, "people", @user.guid).to_s)
end
end
end