Class: RequestTokenTest

Inherits:
ActiveSupport::TestCase
  • Object
show all
Defined in:
lib/generators/test_unit/templates/oauth_token_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



7
8
9
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 7

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

#test_should_authorize_requestObject



35
36
37
38
39
40
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 35

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

#test_should_be_validObject



11
12
13
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 11

def test_should_be_valid
  assert @token.valid?
end

#test_should_have_a_secretObject



23
24
25
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 23

def test_should_have_a_secret
  assert_not_nil @token.secret
end

#test_should_have_a_tokenObject



19
20
21
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 19

def test_should_have_a_token
  assert_not_nil @token.token
end

#test_should_not_be_authorizedObject



27
28
29
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 27

def test_should_not_be_authorized
  assert !@token.authorized?
end

#test_should_not_be_invalidatedObject



31
32
33
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 31

def test_should_not_be_invalidated
  assert !@token.invalidated?
end

#test_should_not_exchange_without_approvalObject



42
43
44
45
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 42

def test_should_not_exchange_without_approval
  assert_equal false, @token.exchange!
  assert_equal false, @token.invalidated?
end

#test_should_not_have_errorsObject



15
16
17
# File 'lib/generators/test_unit/templates/oauth_token_test.rb', line 15

def test_should_not_have_errors
  assert @token.errors.empty?
end