Sha256: a4e5509e31ee32649c3fde84544ea707af2a7d866579e012fd0a90a46f68901d

Contents?: true

Size: 982 Bytes

Versions: 118

Compression:

Stored size: 982 Bytes

Contents

require 'helper'

describe Bearcat::Client::Enrollments do
  let(:client){Bearcat::Client.new(prefix: "http://canvas.instructure.com")}

  it "generates a redirect url" do
    redirect_url = client.auth_redirect_url(10000000000002, 'http://localhost:9393')
    redirect_url.should == "http://canvas.instructure.com/login/oauth2/auth?client_id=10000000000002&redirect_uri=http%3A%2F%2Flocalhost%3A9393&response_type=code"
  end

  it "sets the auth_token" do
    stub_post(client, "/login/oauth2/token").
      with(:body => {"client_id"=>"10000000000002", "client_secret"=>"secret", "code"=>"code", "redirect_url"=>"http://localhost:9393", 'grant_type' => 'authorization_code'}).
      to_return(json_response('access_token.json'))
    client.retrieve_token(10000000000002, 'http://localhost:9393', 'secret', 'code')
    client.config.token.should == "foo_bar_token"
    client.instance_variable_get(:@connection).headers[:authorization].should == 'Bearer foo_bar_token'
  end

end

Version data entries

118 entries across 118 versions & 1 rubygems

Version Path
bearcat-1.3.1 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.18 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.17 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.16 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.15 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.14 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.13 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.12 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.11 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.10 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.9 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.7 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.6 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.5 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.4 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.3 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.1 spec/bearcat/client/o_auth2_spec.rb
bearcat-1.2.0 spec/bearcat/client/o_auth2_spec.rb