2011-08-27 04:09:56 +02:00
|
|
|
# Redmine - project management software
|
2013-01-12 10:29:31 +01:00
|
|
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
2007-05-27 19:42:04 +02: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 04:09:56 +02:00
|
|
|
#
|
2007-05-27 19:42:04 +02: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 04:09:56 +02:00
|
|
|
#
|
2007-05-27 19:42:04 +02: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 00:24:34 +01:00
|
|
|
require File.expand_path('../../test_helper', __FILE__)
|
2007-05-27 19:42:04 +02:00
|
|
|
|
|
|
|
class ProjectsTest < ActionController::IntegrationTest
|
2012-03-03 16:09:20 +01:00
|
|
|
fixtures :projects, :users, :members, :enabled_modules
|
2011-08-27 04:09:56 +02:00
|
|
|
|
2007-05-27 19:42:04 +02: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 14:33:01 +01:00
|
|
|
post "projects/1/archive"
|
2010-11-14 17:45:32 +01:00
|
|
|
assert_redirected_to "/admin/projects"
|
2007-05-27 19:42:04 +02:00
|
|
|
assert !Project.find(1).active?
|
2011-08-27 04:09:56 +02:00
|
|
|
|
2009-01-26 02:47:51 +01:00
|
|
|
get 'projects/1'
|
2007-08-29 18:52:35 +02:00
|
|
|
assert_response 403
|
2009-01-26 02:47:51 +01:00
|
|
|
get "projects/#{subproject.id}"
|
2007-08-29 18:52:35 +02:00
|
|
|
assert_response 403
|
2011-08-27 04:09:56 +02:00
|
|
|
|
2011-12-10 14:33:01 +01:00
|
|
|
post "projects/1/unarchive"
|
2010-11-14 17:45:32 +01:00
|
|
|
assert_redirected_to "/admin/projects"
|
2007-05-27 19:42:04 +02:00
|
|
|
assert Project.find(1).active?
|
2009-01-26 02:47:51 +01:00
|
|
|
get "projects/1"
|
2007-05-27 19:42:04 +02:00
|
|
|
assert_response :success
|
2011-08-27 04:09:56 +02:00
|
|
|
end
|
2012-03-03 16:09:20 +01: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 19:17:49 +02:00
|
|
|
assert_response 404
|
2012-03-03 16:09:20 +01:00
|
|
|
end
|
|
|
|
end
|
2007-05-27 19:42:04 +02:00
|
|
|
end
|