Sha256: 9ba3df7b20fff5f6b52902656f218d859a95f385c22484e6c1f3188f9ca577d9

Contents?: true

Size: 848 Bytes

Versions: 1

Compression:

Stored size: 848 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe OAuth2Client::Grant::Password do

  before :all do
    @host           = 'example.com'
    @client_id      = 's6BhdRkqt3'
    @client_secret  = 'SplxlOBeZQQYbYS6WxSbIA'
    @client = OAuth2Client::Client.new(@host, @client_id, @client_secret)
  end

  subject do
    OAuth2Client::Grant::Password.new(@client)
  end

  describe "#grant_type" do
    it "returns grant type" do
      expect(subject.grant_type).to eq 'password'
    end
  end

  describe "#get_token" do
    it "gets access token" do
      subject.should_receive(:make_request).with(:post, "/oauth2/token", {
        :params => {:grant_type=>"password", :username=>"benutzername", :password=>"passwort"},
        :authenticate=>:headers
      })
      subject.get_token('benutzername', 'passwort')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oauth2-client-2.0.0 spec/oauth2-client/grant/password_spec.rb