2019-03-16 15:03:47 +00:00
|
|
|
# frozen_string_literal: true
|
2019-03-15 01:32:57 +00:00
|
|
|
|
2011-08-24 02:42:02 +00:00
|
|
|
# Redmine - project management software
|
2023-01-01 06:19:35 +00:00
|
|
|
# Copyright (C) 2006-2023 Jean-Philippe Lang
|
2007-12-14 22:00:03 +00: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-24 02:42:02 +00:00
|
|
|
#
|
2007-12-14 22:00:03 +00: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-24 02:42:02 +00:00
|
|
|
#
|
2007-12-14 22:00:03 +00: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.
|
|
|
|
|
|
2023-01-01 07:13:39 +00:00
|
|
|
require_relative '../test_helper'
|
2007-12-14 22:00:03 +00:00
|
|
|
|
2016-07-14 09:35:49 +00:00
|
|
|
class WikisControllerTest < Redmine::ControllerTest
|
2009-05-10 10:54:31 +00:00
|
|
|
fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis
|
2011-08-24 02:42:02 +00:00
|
|
|
|
2007-12-14 22:00:03 +00:00
|
|
|
def setup
|
|
|
|
|
User.current = nil
|
|
|
|
|
end
|
2011-08-24 02:42:02 +00:00
|
|
|
|
2017-06-10 23:55:51 +00:00
|
|
|
def test_get_destroy_should_ask_confirmation
|
2019-10-04 11:17:33 +00:00
|
|
|
set_tmp_attachments_directory
|
2017-06-10 23:55:51 +00:00
|
|
|
@request.session[:user_id] = 1
|
|
|
|
|
assert_no_difference 'Wiki.count' do
|
|
|
|
|
get :destroy, :params => {:id => 1}
|
|
|
|
|
assert_response :success
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-10-23 17:31:04 +00:00
|
|
|
def test_post_destroy_should_delete_wiki
|
2019-10-04 11:17:33 +00:00
|
|
|
set_tmp_attachments_directory
|
2007-12-15 11:57:06 +00:00
|
|
|
@request.session[:user_id] = 1
|
2016-07-16 07:43:16 +00:00
|
|
|
post :destroy, :params => {:id => 1, :confirm => 1}
|
2014-02-04 04:31:29 +00:00
|
|
|
assert_redirected_to :controller => 'projects',
|
2021-07-26 21:27:23 +00:00
|
|
|
:action => 'show', :id => 'ecookbook'
|
2023-10-23 17:31:04 +00:00
|
|
|
assert_nil Project.find(1).wiki
|
2007-12-15 11:57:06 +00:00
|
|
|
end
|
2011-08-24 02:42:02 +00:00
|
|
|
|
2007-12-15 11:57:06 +00:00
|
|
|
def test_not_found
|
|
|
|
|
@request.session[:user_id] = 1
|
2016-07-16 07:43:16 +00:00
|
|
|
post :destroy, :params => {:id => 999, :confirm => 1}
|
2007-12-15 11:57:06 +00:00
|
|
|
assert_response 404
|
|
|
|
|
end
|
2011-08-24 02:42:02 +00:00
|
|
|
end
|