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:
parent
2ad330d642
commit
b8f6dbd403
85 changed files with 3277 additions and 9 deletions
17
test/unit/client_application_test.rb
Normal file
17
test/unit/client_application_test.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue