2011-08-27 06:09:56 +04:00
|
|
|
# Redmine - project management software
|
|
|
|
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
2007-05-27 21:42:04 +04:00
|
|
|
#
|
|
|
|
# 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.
|
2011-08-27 06:09:56 +04:00
|
|
|
#
|
2007-05-27 21:42:04 +04:00
|
|
|
# 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.
|
2011-08-27 06:09:56 +04:00
|
|
|
#
|
2007-05-27 21:42:04 +04:00
|
|
|
# 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.
|
|
|
|
|
2010-12-13 02:24:34 +03:00
|
|
|
require File.expand_path('../../test_helper', __FILE__)
|
2007-05-27 21:42:04 +04:00
|
|
|
|
|
|
|
class ProjectsTest < ActionController::IntegrationTest
|
2012-03-03 19:09:20 +04:00
|
|
|
fixtures :projects, :users, :members, :enabled_modules
|
2011-08-27 06:09:56 +04:00
|
|
|
|
2007-05-27 21:42:04 +04:00
|
|
|
def test_archive_project
|
|
|
|
subproject = Project.find(1).children.first
|
|
|
|
log_user("admin", "admin")
|
|
|
|
get "admin/projects"
|
|
|
|
assert_response :success
|
|
|
|
assert_template "admin/projects"
|
2011-12-10 17:33:01 +04:00
|
|
|
post "projects/1/archive"
|
2010-11-14 19:45:32 +03:00
|
|
|
assert_redirected_to "/admin/projects"
|
2007-05-27 21:42:04 +04:00
|
|
|
assert !Project.find(1).active?
|
2011-08-27 06:09:56 +04:00
|
|
|
|
2009-01-26 04:47:51 +03:00
|
|
|
get 'projects/1'
|
2007-08-29 20:52:35 +04:00
|
|
|
assert_response 403
|
2009-01-26 04:47:51 +03:00
|
|
|
get "projects/#{subproject.id}"
|
2007-08-29 20:52:35 +04:00
|
|
|
assert_response 403
|
2011-08-27 06:09:56 +04:00
|
|
|
|
2011-12-10 17:33:01 +04:00
|
|
|
post "projects/1/unarchive"
|
2010-11-14 19:45:32 +03:00
|
|
|
assert_redirected_to "/admin/projects"
|
2007-05-27 21:42:04 +04:00
|
|
|
assert Project.find(1).active?
|
2009-01-26 04:47:51 +03:00
|
|
|
get "projects/1"
|
2007-05-27 21:42:04 +04:00
|
|
|
assert_response :success
|
2011-08-27 06:09:56 +04:00
|
|
|
end
|
2012-03-03 19:09:20 +04:00
|
|
|
|
|
|
|
def test_modules_should_not_allow_get
|
|
|
|
assert_no_difference 'EnabledModule.count' do
|
|
|
|
get '/projects/1/modules', {:enabled_module_names => ['']}, credentials('jsmith')
|
2012-04-25 21:17:49 +04:00
|
|
|
assert_response 404
|
2012-03-03 19:09:20 +04:00
|
|
|
end
|
|
|
|
end
|
2007-05-27 21:42:04 +04:00
|
|
|
end
|