Sha256: 162319e547d01e5374d0e791c5c885ab4e9d2bcfc07cddc444130632063fa90f

Contents?: true

Size: 934 Bytes

Versions: 2

Compression:

Stored size: 934 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class AuthTest < Test::Unit::TestCase
  include Upcoming
  
  context "when using the authentication API" do
    setup do
      Upcoming.api_key = 'OU812'
    end

    should "retrieve a token from the site" do
      stub_get "http://upcoming.yahooapis.com/services/rest/?method=auth.getToken&frob=123456&api_key=OU812&format=json", 'token.json'
      token = Upcoming::Auth.token(123456)
      token.token.should == "1234567890123456789012345678901234467890"
      token.user_id.should == 674
    end
    
    should "check a token based on the 40-digit token code" do
      stub_get "http://upcoming.yahooapis.com/services/rest/?method=auth.checkToken&token=123456&api_key=OU812&format=json", 'token.json'
      token = Upcoming::Auth.check_token(123456)
      token.token.should == "1234567890123456789012345678901234467890"
      token.user_id.should == 674
    end
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
squeejee-upcoming-events-0.0.1 test/upcoming/auth_test.rb
upcoming-events-0.0.1 test/upcoming/auth_test.rb