]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb
Merge branch 'master' into openid
[rails.git] / vendor / plugins / oauth-plugin / generators / oauth_provider / templates / client_application_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2 module OAuthHelpers
3   
4   def create_consumer
5     @consumer=OAuth::Consumer.new(@application.key,@application.secret,
6       {
7         :site=>@application.oauth_server.base_url
8       })
9   end
10   
11 end
12
13 class ClientApplicationTest < ActiveSupport::TestCase
14   include OAuthHelpers
15   fixtures :users,:client_applications,:oauth_tokens
16   
17   def setup
18     @application = ClientApplication.create :name=>"Agree2",:url=>"http://agree2.com",:user=>users(:quentin)
19     create_consumer
20   end
21
22   def test_should_be_valid
23     assert @application.valid?
24   end
25   
26     
27   def test_should_not_have_errors
28     assert_equal [], @application.errors.full_messages
29   end
30   
31   def test_should_have_key_and_secret
32     assert_not_nil @application.key
33     assert_not_nil @application.secret
34   end
35
36   def test_should_have_credentials
37     assert_not_nil @application.credentials
38     assert_equal @application.key, @application.credentials.key
39     assert_equal @application.secret, @application.credentials.secret
40   end
41   
42 end