File: oauth2_spec.rb

package info (click to toggle)
ruby-em-http-request 1.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 628 kB
  • ctags: 243
  • sloc: ruby: 3,478; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
describe EventMachine::Middleware::OAuth2 do
  it "should add an access token to a URI with no query parameters" do
    middleware = EventMachine::Middleware::OAuth2.new(:access_token => "fedcba9876543210")
    uri = Addressable::URI.parse("https://graph.facebook.com/me")
    middleware.update_uri! uri
    uri.to_s.should == "https://graph.facebook.com/me?access_token=fedcba9876543210"
  end

  it "should add an access token to a URI with query parameters" do
    middleware = EventMachine::Middleware::OAuth2.new(:access_token => "fedcba9876543210")
    uri = Addressable::URI.parse("https://graph.facebook.com/me?fields=photo")
    middleware.update_uri! uri
    uri.to_s.should == "https://graph.facebook.com/me?fields=photo&access_token=fedcba9876543210"
  end
end