Sha256: 9a10393e734c20dbb0c8416347be9b97e840c70a67666bf99ecd6e020db7d406
Contents?: true
Size: 1.34 KB
Versions: 10
Compression:
Stored size: 1.34 KB
Contents
shared_examples_for 'client login prompts' do let(:uaa) { CFoundry::UAAClient.new('http://uaa.example.com') } let(:prompts) do { :user_id => ["text", "User ID"], :pin => ["password", "Your 8-digit Pin #"] } end before do allow(client.base).to receive(:uaa) { uaa } allow(uaa).to receive(:prompts) { prompts } end subject { client.login_prompts } it 'returns the prompts provided by UAA' do expect(subject).to eq(prompts) end end shared_examples_for 'client login' do let(:email) { 'test@test.com' } let(:password) { 'secret' } let(:uaa) { CFoundry::UAAClient.new('http://uaa.example.com') } let(:access_token) { "some-access-token" } let(:token_info) { CF::UAA::TokenInfo.new({ :access_token => access_token, :token_type => "bearer" }) } before do allow(client.base).to receive(:uaa) { uaa } allow(uaa).to receive(:authorize).with(:username => email, :password => password) { token_info } end subject { client.login(:username => email, :password => password) } it 'returns a UAA token' do expect(subject).to be_a(CFoundry::AuthToken) expect(subject.auth_header).to eq("bearer #{access_token}") end it 'saves the data as the token' do subject expect(client.token).to be_a(CFoundry::AuthToken) expect(client.token.auth_header).to eq("bearer #{access_token}") end end
Version data entries
10 entries across 10 versions & 2 rubygems