Sha256: 6324f3fca2b1e28b45331d1e8499ea6f6f42b19165a6441f660d10101660d5b6

Contents?: true

Size: 1.28 KB

Versions: 32

Compression:

Stored size: 1.28 KB

Contents

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

class RequestTokenTest < ActiveSupport::TestCase

  fixtures :client_applications, :users, :oauth_tokens
  
  def setup
    @token = RequestToken.create :client_application=>client_applications(:one)
  end

  def test_should_be_valid
    assert @token.valid?
  end
  
  def test_should_not_have_errors
    assert @token.errors.empty?
  end
  
  def test_should_have_a_token
    assert_not_nil @token.token
  end

  def test_should_have_a_secret
    assert_not_nil @token.secret
  end
  
  def test_should_not_be_authorized 
    assert !@token.authorized?
  end

  def test_should_not_be_invalidated
    assert !@token.invalidated?
  end
  
  def test_should_authorize_request
    @token.authorize!(users(:quentin))
    assert @token.authorized?
    assert_not_nil @token.authorized_at
    assert_equal users(:quentin), @token.user
  end
  
  def test_should_not_exchange_without_approval
    assert_equal false, @token.exchange!
    assert_equal false, @token.invalidated?
  end
  
  def test_should_not_exchange_without_approval
    @token.authorize!(users(:quentin))
    @access = @token.exchange!
    assert_not_equal false, @access
    assert @token.invalidated?
    
    assert_equal users(:quentin), @access.user
    assert @access.authorized?
  end
  
end

Version data entries

32 entries across 32 versions & 5 rubygems

Version Path
filiptepper-oauth-plugin-0.3.11 generators/oauth_provider/templates/oauth_token_test.rb
pelle-oauth-plugin-0.3.10 generators/oauth_provider/templates/oauth_token_test.rb
pelle-oauth-plugin-0.3.11 generators/oauth_provider/templates/oauth_token_test.rb
pelle-oauth-plugin-0.3.5 generators/oauth_provider/templates/oauth_token_test.rb
pelle-oauth-plugin-0.3.6 generators/oauth_provider/templates/oauth_token_test.rb
pelle-oauth-plugin-0.3.7 generators/oauth_provider/templates/oauth_token_test.rb
pelle-oauth-plugin-0.3.8 generators/oauth_provider/templates/oauth_token_test.rb
pelle-oauth-plugin-0.3.9 generators/oauth_provider/templates/oauth_token_test.rb
oauth-plugin-0.4.0.rc2 generators/oauth_provider/templates/oauth_token_test.rb
oauth-plugin-0.4.0.rc1 generators/oauth_provider/templates/oauth_token_test.rb
oauth-plugin-0.4.0.pre7 generators/oauth_provider/templates/oauth_token_test.rb
oauth-plugin-0.4.0.pre6 generators/oauth_provider/templates/oauth_token_test.rb
oauth-plugin-0.4.0.pre5 generators/oauth_provider/templates/oauth_token_test.rb
insrc-oauth-plugin-0.4.0.pre6 generators/oauth_provider/templates/oauth_token_test.rb
insrc-oauth-plugin-0.4.0.pre5 generators/oauth_provider/templates/oauth_token_test.rb
le1t0-oauth-plugin-0.3.14.001 generators/oauth_provider/templates/oauth_token_test.rb
le1t0-oauth-plugin-0.4.0.pre4.001 generators/oauth_provider/templates/oauth_token_test.rb
oauth-plugin-0.4.0.pre4 generators/oauth_provider/templates/oauth_token_test.rb
oauth-plugin-0.4.0.pre3 generators/oauth_provider/templates/oauth_token_test.rb
oauth-plugin-0.4.0.pre2 generators/oauth_provider/templates/oauth_token_test.rb