Merged trunk r1773.
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1774 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -17,6 +17,12 @@
|
||||
|
||||
require "#{File.dirname(__FILE__)}/../test_helper"
|
||||
|
||||
begin
|
||||
require 'mocha'
|
||||
rescue
|
||||
# Won't run some tests
|
||||
end
|
||||
|
||||
class AccountTest < ActionController::IntegrationTest
|
||||
fixtures :users
|
||||
|
||||
@@ -67,8 +73,12 @@ class AccountTest < ActionController::IntegrationTest
|
||||
|
||||
post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"},
|
||||
:password => "newpass", :password_confirmation => "newpass"
|
||||
assert_redirected_to 'account/login'
|
||||
log_user('newuser', 'newpass')
|
||||
assert_redirected_to 'my/account'
|
||||
follow_redirect!
|
||||
assert_response :success
|
||||
assert_template 'my/account'
|
||||
|
||||
assert User.find_by_login('newuser').active?
|
||||
end
|
||||
|
||||
def test_register_with_manual_activation
|
||||
@@ -98,4 +108,46 @@ class AccountTest < ActionController::IntegrationTest
|
||||
assert_redirected_to 'account/login'
|
||||
log_user('newuser', 'newpass')
|
||||
end
|
||||
|
||||
if Object.const_defined?(:Mocha)
|
||||
|
||||
def test_onthefly_registration
|
||||
# disable registration
|
||||
Setting.self_registration = '0'
|
||||
AuthSource.expects(:authenticate).returns([:login => 'foo', :firstname => 'Foo', :lastname => 'Smith', :mail => 'foo@bar.com', :auth_source_id => 66])
|
||||
|
||||
post 'account/login', :username => 'foo', :password => 'bar'
|
||||
assert_redirected_to 'my/page'
|
||||
|
||||
user = User.find_by_login('foo')
|
||||
assert user.is_a?(User)
|
||||
assert_equal 66, user.auth_source_id
|
||||
assert user.hashed_password.blank?
|
||||
end
|
||||
|
||||
def test_onthefly_registration_with_invalid_attributes
|
||||
# disable registration
|
||||
Setting.self_registration = '0'
|
||||
AuthSource.expects(:authenticate).returns([:login => 'foo', :lastname => 'Smith', :auth_source_id => 66])
|
||||
|
||||
post 'account/login', :username => 'foo', :password => 'bar'
|
||||
assert_response :success
|
||||
assert_template 'account/register'
|
||||
assert_tag :input, :attributes => { :name => 'user[firstname]', :value => '' }
|
||||
assert_tag :input, :attributes => { :name => 'user[lastname]', :value => 'Smith' }
|
||||
assert_no_tag :input, :attributes => { :name => 'user[login]' }
|
||||
assert_no_tag :input, :attributes => { :name => 'user[password]' }
|
||||
|
||||
post 'account/register', :user => {:firstname => 'Foo', :lastname => 'Smith', :mail => 'foo@bar.com'}
|
||||
assert_redirected_to 'my/account'
|
||||
|
||||
user = User.find_by_login('foo')
|
||||
assert user.is_a?(User)
|
||||
assert_equal 66, user.auth_source_id
|
||||
assert user.hashed_password.blank?
|
||||
end
|
||||
|
||||
else
|
||||
puts 'Mocha is missing. Skipping tests.'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,8 +48,9 @@ class AdminTest < ActionController::IntegrationTest
|
||||
post "projects/add", :project => { :name => "blog",
|
||||
:description => "weblog",
|
||||
:identifier => "blog",
|
||||
:is_public => 1 },
|
||||
'custom_fields[3]' => 'Beta'
|
||||
:is_public => 1,
|
||||
:custom_field_values => { '3' => 'Beta' }
|
||||
}
|
||||
assert_redirected_to "admin/projects"
|
||||
assert_equal 'Successful creation.', flash[:notice]
|
||||
|
||||
|
||||
@@ -1,10 +1,30 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2008 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require "#{File.dirname(__FILE__)}/../test_helper"
|
||||
|
||||
class IssuesTest < ActionController::IntegrationTest
|
||||
fixtures :projects,
|
||||
:users,
|
||||
:roles,
|
||||
:members,
|
||||
:trackers,
|
||||
:projects_trackers,
|
||||
:enabled_modules,
|
||||
:issue_statuses,
|
||||
:issues,
|
||||
:enumerations,
|
||||
@@ -47,6 +67,7 @@ class IssuesTest < ActionController::IntegrationTest
|
||||
# add then remove 2 attachments to an issue
|
||||
def test_issue_attachements
|
||||
log_user('jsmith', 'jsmith')
|
||||
set_tmp_attachments_directory
|
||||
|
||||
post 'issues/edit/1',
|
||||
:notes => 'Some notes',
|
||||
|
||||
Reference in New Issue
Block a user