remove trailing white-spaces from test/test_helper.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6946 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d51cc908fe
commit
5409e5dfca
|
@ -47,7 +47,7 @@ class ActiveSupport::TestCase
|
|||
self.use_instantiated_fixtures = false
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
|
||||
|
||||
def log_user(login, password)
|
||||
User.anonymous
|
||||
get "/login"
|
||||
|
@ -57,7 +57,7 @@ class ActiveSupport::TestCase
|
|||
post "/login", :username => login, :password => password
|
||||
assert_equal login, User.find(session[:user_id]).login
|
||||
end
|
||||
|
||||
|
||||
def uploaded_test_file(name, mime)
|
||||
ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime, true)
|
||||
end
|
||||
|
@ -127,7 +127,7 @@ class ActiveSupport::TestCase
|
|||
def assert_error_tag(options={})
|
||||
assert_tag({:attributes => { :id => 'errorExplanation' }}.merge(options))
|
||||
end
|
||||
|
||||
|
||||
def assert_include(expected, s)
|
||||
assert s.include?(expected), "\"#{expected}\" not found in \"#{s}\""
|
||||
end
|
||||
|
@ -176,7 +176,7 @@ class ActiveSupport::TestCase
|
|||
:old_value => @old_value.id,
|
||||
:value => @new_value.id,
|
||||
:prop_key => prop_key)
|
||||
|
||||
|
||||
assert_match @new_value.name, show_detail(@detail, true)
|
||||
end
|
||||
|
||||
|
@ -185,7 +185,7 @@ class ActiveSupport::TestCase
|
|||
:old_value => @old_value.id,
|
||||
:value => @new_value.id,
|
||||
:prop_key => prop_key)
|
||||
|
||||
|
||||
assert_match @old_value.name, show_detail(@detail, true)
|
||||
end
|
||||
end
|
||||
|
@ -229,7 +229,7 @@ class ActiveSupport::TestCase
|
|||
def self.should_allow_http_basic_auth_with_username_and_password(http_method, url, parameters={}, options={})
|
||||
success_code = options[:success_code] || :success
|
||||
failure_code = options[:failure_code] || :unauthorized
|
||||
|
||||
|
||||
context "should allow http basic auth using a username and password for #{http_method} #{url}" do
|
||||
context "with a valid HTTP authentication" do
|
||||
setup do
|
||||
|
@ -237,7 +237,7 @@ class ActiveSupport::TestCase
|
|||
@authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@user.login, 'my_password')
|
||||
send(http_method, url, parameters, {:authorization => @authorization})
|
||||
end
|
||||
|
||||
|
||||
should_respond_with success_code
|
||||
should_respond_with_content_type_based_on_url(url)
|
||||
should "login as the user" do
|
||||
|
@ -251,14 +251,14 @@ class ActiveSupport::TestCase
|
|||
@authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@user.login, 'wrong_password')
|
||||
send(http_method, url, parameters, {:authorization => @authorization})
|
||||
end
|
||||
|
||||
|
||||
should_respond_with failure_code
|
||||
should_respond_with_content_type_based_on_url(url)
|
||||
should "not login as the user" do
|
||||
assert_equal User.anonymous, User.current
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "without credentials" do
|
||||
setup do
|
||||
send(http_method, url, parameters, {:authorization => ''})
|
||||
|
@ -294,7 +294,7 @@ class ActiveSupport::TestCase
|
|||
@authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@token.value, 'X')
|
||||
send(http_method, url, parameters, {:authorization => @authorization})
|
||||
end
|
||||
|
||||
|
||||
should_respond_with success_code
|
||||
should_respond_with_content_type_based_on_url(url)
|
||||
should_be_a_valid_response_string_based_on_url(url)
|
||||
|
@ -319,7 +319,7 @@ class ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Test that a request allows full key authentication
|
||||
#
|
||||
# @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete)
|
||||
|
@ -345,7 +345,7 @@ class ActiveSupport::TestCase
|
|||
end
|
||||
send(http_method, request_url, parameters)
|
||||
end
|
||||
|
||||
|
||||
should_respond_with success_code
|
||||
should_respond_with_content_type_based_on_url(url)
|
||||
should_be_a_valid_response_string_based_on_url(url)
|
||||
|
@ -366,7 +366,7 @@ class ActiveSupport::TestCase
|
|||
end
|
||||
send(http_method, request_url, parameters)
|
||||
end
|
||||
|
||||
|
||||
should_respond_with failure_code
|
||||
should_respond_with_content_type_based_on_url(url)
|
||||
should "not login as the user" do
|
||||
|
@ -374,14 +374,14 @@ class ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "should allow key based auth using X-Redmine-API-Key header for #{http_method} #{url}" do
|
||||
setup do
|
||||
@user = User.generate_with_protected!(:admin => true)
|
||||
@token = Token.generate!(:user => @user, :action => 'api')
|
||||
send(http_method, url, parameters, {'X-Redmine-API-Key' => @token.value.to_s})
|
||||
end
|
||||
|
||||
|
||||
should_respond_with success_code
|
||||
should_respond_with_content_type_based_on_url(url)
|
||||
should_be_a_valid_response_string_based_on_url(url)
|
||||
|
@ -406,7 +406,7 @@ class ActiveSupport::TestCase
|
|||
else
|
||||
raise "Unknown content type for should_respond_with_content_type_based_on_url: #{url}"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Uses the url to assert which format the response should be in
|
||||
|
@ -424,9 +424,9 @@ class ActiveSupport::TestCase
|
|||
else
|
||||
raise "Unknown content type for should_be_a_valid_response_based_on_url: #{url}"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
# Checks that the response is a valid JSON string
|
||||
def self.should_be_a_valid_json_string
|
||||
should "be a valid JSON string (or empty)" do
|
||||
|
@ -440,7 +440,7 @@ class ActiveSupport::TestCase
|
|||
assert REXML::Document.new(response.body)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Simple module to "namespace" all of the API tests
|
||||
|
|
Loading…
Reference in New Issue