X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/fa11baf5c348d6eb4ca00d6d15cf9893626fa2d6..406b46e49b786fab879286d77735b2a16c1cfcc5:/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb new file mode 100644 index 000000000..3ba2cf7d9 --- /dev/null +++ b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb @@ -0,0 +1,42 @@ +require File.dirname(__FILE__) + '/../test_helper' +module OAuthHelpers + + def create_consumer + @consumer=OAuth::Consumer.new(@application.key,@application.secret, + { + :site=>@application.oauth_server.base_url + }) + end + +end + +class ClientApplicationTest < ActiveSupport::TestCase + include OAuthHelpers + fixtures :users,:client_applications,:oauth_tokens + + def setup + @application = ClientApplication.create :name=>"Agree2",:url=>"http://agree2.com",:user=>users(:quentin) + create_consumer + end + + def test_should_be_valid + assert @application.valid? + end + + + def test_should_not_have_errors + assert_equal [], @application.errors.full_messages + end + + def test_should_have_key_and_secret + assert_not_nil @application.key + assert_not_nil @application.secret + end + + def test_should_have_credentials + assert_not_nil @application.credentials + assert_equal @application.key, @application.credentials.key + assert_equal @application.secret, @application.credentials.secret + end + +end \ No newline at end of file