Sha256: 4204ff406ff0d33cb35bea320715c46832f26b1ce1c6f15befa3a4d3ee7e387e

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require 'spec/spec_helper'

describe SK::SDK::Oauth, "in general" do

  before :each do
    #setup test oAuth-data to work with
    load_settings
  end

  it "should create a new instance" do
    lambda{ SK::SDK::Oauth.new(@set)}.should_not raise_error
  end

  it "should get salesking url" do
    a = SK::SDK::Oauth.new(@set)
    a.sub_domain = 'alki'
    a.sk_url.should == "http://alki.horsts-lokal.local"
  end

  it "should get auth_dialog url" do
    a = SK::SDK::Oauth.new(@set)
    a.sub_domain = 'alki'
    a.auth_dialog.should include "http://alki.horsts-lokal.local/oauth/authorize?"
    a.auth_dialog.should include @set['id']
    a.auth_dialog.should include CGI::escape @set['redirect_url']
    a.auth_dialog.should include CGI::escape @set['scope']
  end

  it "should get sk_canvas_url" do
    a = SK::SDK::Oauth.new(@set)
    a.sub_domain = 'alki'
    a.sk_canvas_url.should == "http://alki.horsts-lokal.local/app/canvas-page"
  end

  it "should get token_url" do
    a = SK::SDK::Oauth.new(@set)
    a.sub_domain = 'alki'
    url = a.token_url('some-code')
    url.should include @set['id']
    url.should include @set['secret']
    url.should include CGI::escape @set['redirect_url']
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sk_sdk-0.0.7 spec/sk_sdk/oauth_spec.rb
sk_sdk-0.0.6 spec/sk_sdk/oauth_spec.rb
sk_sdk-0.0.5 spec/sk_sdk/oauth_spec.rb
sk_sdk-0.0.4 spec/sk_sdk/oauth_spec.rb