]> git.openstreetmap.org Git - rails.git/blob - test/unit/client_application_test.rb
213d4d28c5e47cc55f8bacae68885f67e9b9017f
[rails.git] / test / unit / client_application_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class ClientApplicationTest < ActiveSupport::TestCase
4   api_fixtures
5
6   ##
7   # test that tokens can't be found unless they're authorised
8   def test_find_token
9     tok = client_applications(:oauth_web_app).create_request_token
10     assert_equal false, tok.authorized?, "Token should be created unauthorised."
11     assert_equal nil, ClientApplication.find_token(tok.token), "Shouldn't be able to find unauthorised token"
12     tok.authorize!(users(:public_user))
13     assert_equal true, tok.authorized?, "Token should now be authorised."
14     assert_not_equal nil, ClientApplication.find_token(tok.token), "Should be able to find authorised token"
15   end
16
17 end