Adding initial version of the OAuth token authentication method. This adds basic OAuth support for registering apps, getting and revoking keys, etc... The tokens come with 6 separate permissions bits; read/write user preferences, write diaries, write API and read/write GPS traces. Needs more tests.

This commit is contained in:
Matt Amos 2009-06-22 16:54:37 +00:00
parent 2ad330d642
commit b8f6dbd403
85 changed files with 3277 additions and 9 deletions

View file

@ -0,0 +1,17 @@
require File.dirname(__FILE__) + '/../test_helper'
class ClientApplicationTest < ActiveSupport::TestCase
api_fixtures
##
# test that tokens can't be found unless they're authorised
def test_find_token
tok = client_applications(:oauth_web_app).create_request_token
assert_equal false, tok.authorized?, "Token should be created unauthorised."
assert_equal nil, ClientApplication.find_token(tok.token), "Shouldn't be able to find unauthorised token"
tok.authorize!(users(:public_user))
assert_equal true, tok.authorized?, "Token should now be authorised."
assert_not_equal nil, ClientApplication.find_token(tok.token), "Should be able to find authorised token"
end
end