]> git.openstreetmap.org Git - rails.git/blob - test/models/oauth_token_test.rb
Use bootstrap utility class instead of custom css
[rails.git] / test / models / oauth_token_test.rb
1 require "test_helper"
2
3 class OauthTokenTest < ActiveSupport::TestCase
4   ##
5   # check that after calling invalidate! on a token, it is invalid.
6   def test_token_invalidation
7     tok = OauthToken.new
8     assert_not tok.invalidated?, "Token should be created valid."
9     tok.invalidate!
10     assert tok.invalidated?, "Token should now be invalid."
11   end
12
13   ##
14   # check that an authorized token is authorised and can be invalidated
15   def test_token_authorisation
16     tok = RequestToken.create(:client_application => create(:client_application))
17     assert_not tok.authorized?, "Token should be created unauthorised."
18     tok.authorize!(create(:user))
19     assert tok.authorized?, "Token should now be authorised."
20     tok.invalidate!
21     assert_not tok.authorized?, "Token should now be invalid."
22   end
23 end