Removes all #verify calls in controllers. Verification is handled at routing level now that the default route is removed.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9061 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bf8f854546
commit
b3866b05c1
@ -82,7 +82,6 @@ class AttachmentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy
|
|
||||||
def destroy
|
def destroy
|
||||||
# Make sure association callbacks are called
|
# Make sure association callbacks are called
|
||||||
@attachment.container.attachments.delete(@attachment)
|
@attachment.container.attachments.delete(@attachment)
|
||||||
|
@ -20,10 +20,6 @@ class AuthSourcesController < ApplicationController
|
|||||||
|
|
||||||
before_filter :require_admin
|
before_filter :require_admin
|
||||||
|
|
||||||
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
|
|
||||||
verify :method => :post, :only => [ :destroy, :create, :update ],
|
|
||||||
:redirect_to => { :template => :index }
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@auth_source_pages, @auth_sources = paginate auth_source_class.name.tableize, :per_page => 10
|
@auth_source_pages, @auth_sources = paginate auth_source_class.name.tableize, :per_page => 10
|
||||||
render "auth_sources/index"
|
render "auth_sources/index"
|
||||||
|
@ -63,7 +63,6 @@ class BoardsController < ApplicationController
|
|||||||
@board = @project.boards.build(params[:board])
|
@board = @project.boards.build(params[:board])
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :create, :redirect_to => { :action => :index }
|
|
||||||
def create
|
def create
|
||||||
@board = @project.boards.build(params[:board])
|
@board = @project.boards.build(params[:board])
|
||||||
if @board.save
|
if @board.save
|
||||||
@ -77,7 +76,6 @@ class BoardsController < ApplicationController
|
|||||||
def edit
|
def edit
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :put, :only => :update, :redirect_to => { :action => :index }
|
|
||||||
def update
|
def update
|
||||||
if @board.update_attributes(params[:board])
|
if @board.update_attributes(params[:board])
|
||||||
redirect_to_settings_in_projects
|
redirect_to_settings_in_projects
|
||||||
@ -86,7 +84,6 @@ class BoardsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index }
|
|
||||||
def destroy
|
def destroy
|
||||||
@board.destroy
|
@board.destroy
|
||||||
redirect_to_settings_in_projects
|
redirect_to_settings_in_projects
|
||||||
|
@ -22,7 +22,6 @@ class CommentsController < ApplicationController
|
|||||||
before_filter :find_project_from_association
|
before_filter :find_project_from_association
|
||||||
before_filter :authorize
|
before_filter :authorize
|
||||||
|
|
||||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def create
|
def create
|
||||||
raise Unauthorized unless @news.commentable?
|
raise Unauthorized unless @news.commentable?
|
||||||
|
|
||||||
@ -35,7 +34,6 @@ class CommentsController < ApplicationController
|
|||||||
redirect_to :controller => 'news', :action => 'show', :id => @news
|
redirect_to :controller => 'news', :action => 'show', :id => @news
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy
|
def destroy
|
||||||
@news.comments.find(params[:comment_id]).destroy
|
@news.comments.find(params[:comment_id]).destroy
|
||||||
redirect_to :controller => 'news', :action => 'show', :id => @news
|
redirect_to :controller => 'news', :action => 'show', :id => @news
|
||||||
|
@ -51,7 +51,6 @@ class EnumerationsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => { :nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy
|
def destroy
|
||||||
if !@enumeration.in_use?
|
if !@enumeration.in_use?
|
||||||
# No associated objects
|
# No associated objects
|
||||||
|
@ -42,7 +42,6 @@ class IssueCategoriesController < ApplicationController
|
|||||||
@category = @project.issue_categories.build(params[:issue_category])
|
@category = @project.issue_categories.build(params[:issue_category])
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :create
|
|
||||||
def create
|
def create
|
||||||
@category = @project.issue_categories.build(params[:issue_category])
|
@category = @project.issue_categories.build(params[:issue_category])
|
||||||
if @category.save
|
if @category.save
|
||||||
@ -73,7 +72,6 @@ class IssueCategoriesController < ApplicationController
|
|||||||
def edit
|
def edit
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :put, :only => :update
|
|
||||||
def update
|
def update
|
||||||
if @category.update_attributes(params[:issue_category])
|
if @category.update_attributes(params[:issue_category])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
@ -91,7 +89,6 @@ class IssueCategoriesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy
|
|
||||||
def destroy
|
def destroy
|
||||||
@issue_count = @category.issues.size
|
@issue_count = @category.issues.size
|
||||||
if @issue_count == 0 || params[:todo] || api_request?
|
if @issue_count == 0 || params[:todo] || api_request?
|
||||||
|
@ -39,7 +39,6 @@ class IssueRelationsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def create
|
def create
|
||||||
@relation = IssueRelation.new(params[:relation])
|
@relation = IssueRelation.new(params[:relation])
|
||||||
@relation.issue_from = @issue
|
@relation.issue_from = @issue
|
||||||
@ -70,7 +69,6 @@ class IssueRelationsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy
|
def destroy
|
||||||
raise Unauthorized unless @relation.deletable?
|
raise Unauthorized unless @relation.deletable?
|
||||||
@relation.destroy
|
@relation.destroy
|
||||||
|
@ -62,7 +62,6 @@ class IssueStatusesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index }
|
|
||||||
def destroy
|
def destroy
|
||||||
IssueStatus.find(params[:id]).destroy
|
IssueStatus.find(params[:id]).destroy
|
||||||
redirect_to :action => 'index'
|
redirect_to :action => 'index'
|
||||||
|
@ -53,10 +53,6 @@ class IssuesController < ApplicationController
|
|||||||
helper :gantt
|
helper :gantt
|
||||||
include Redmine::Export::PDF
|
include Redmine::Export::PDF
|
||||||
|
|
||||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
verify :method => :post, :only => :bulk_update, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
retrieve_query
|
retrieve_query
|
||||||
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
|
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
|
||||||
@ -275,7 +271,6 @@ class IssuesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => { :nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy
|
def destroy
|
||||||
@hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
|
@hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
|
||||||
if @hours > 0
|
if @hours > 0
|
||||||
|
@ -18,10 +18,6 @@
|
|||||||
class MailHandlerController < ActionController::Base
|
class MailHandlerController < ActionController::Base
|
||||||
before_filter :check_credential
|
before_filter :check_credential
|
||||||
|
|
||||||
verify :method => :post,
|
|
||||||
:only => :index,
|
|
||||||
:render => { :nothing => true, :status => 405 }
|
|
||||||
|
|
||||||
# Submits an incoming email to MailHandler
|
# Submits an incoming email to MailHandler
|
||||||
def index
|
def index
|
||||||
options = params.dup
|
options = params.dup
|
||||||
|
@ -22,9 +22,6 @@ class MessagesController < ApplicationController
|
|||||||
before_filter :find_message, :except => [:new, :preview]
|
before_filter :find_message, :except => [:new, :preview]
|
||||||
before_filter :authorize, :except => [:preview, :edit, :destroy]
|
before_filter :authorize, :except => [:preview, :edit, :destroy]
|
||||||
|
|
||||||
verify :method => :post, :only => [ :reply, :destroy ], :redirect_to => { :action => :show }
|
|
||||||
verify :xhr => true, :only => :quote
|
|
||||||
|
|
||||||
helper :watchers
|
helper :watchers
|
||||||
helper :attachments
|
helper :attachments
|
||||||
include AttachmentsHelper
|
include AttachmentsHelper
|
||||||
|
@ -35,9 +35,6 @@ class MyController < ApplicationController
|
|||||||
'right' => ['issuesreportedbyme']
|
'right' => ['issuesreportedbyme']
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
verify :xhr => true,
|
|
||||||
:only => [:add_block, :remove_block, :order_blocks]
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
page
|
page
|
||||||
render :action => 'page'
|
render :action => 'page'
|
||||||
|
@ -69,7 +69,6 @@ class ProjectsController < ApplicationController
|
|||||||
@project = Project.new(params[:project])
|
@project = Project.new(params[:project])
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def create
|
def create
|
||||||
@issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
|
@issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
|
||||||
@trackers = Tracker.all
|
@trackers = Tracker.all
|
||||||
@ -182,8 +181,6 @@ class ProjectsController < ApplicationController
|
|||||||
def edit
|
def edit
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: convert to PUT only
|
|
||||||
verify :method => [:post, :put], :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def update
|
def update
|
||||||
@project.safe_attributes = params[:project]
|
@project.safe_attributes = params[:project]
|
||||||
if validate_parent_id && @project.save
|
if validate_parent_id && @project.save
|
||||||
@ -206,7 +203,6 @@ class ProjectsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :modules, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def modules
|
def modules
|
||||||
@project.enabled_module_names = params[:enabled_module_names]
|
@project.enabled_module_names = params[:enabled_module_names]
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
@ -227,7 +223,6 @@ class ProjectsController < ApplicationController
|
|||||||
redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
|
redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
# Delete @project
|
# Delete @project
|
||||||
def destroy
|
def destroy
|
||||||
@project_to_destroy = @project
|
@project_to_destroy = @project
|
||||||
|
@ -50,7 +50,6 @@ class QueriesController < ApplicationController
|
|||||||
build_query_from_params
|
build_query_from_params
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def create
|
def create
|
||||||
@query = Query.new(params[:query])
|
@query = Query.new(params[:query])
|
||||||
@query.user = User.current
|
@query.user = User.current
|
||||||
@ -70,7 +69,6 @@ class QueriesController < ApplicationController
|
|||||||
def edit
|
def edit
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def update
|
def update
|
||||||
@query.attributes = params[:query]
|
@query.attributes = params[:query]
|
||||||
@query.project = nil if params[:query_is_for_all]
|
@query.project = nil if params[:query_is_for_all]
|
||||||
@ -86,7 +84,6 @@ class QueriesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy
|
def destroy
|
||||||
@query.destroy
|
@query.destroy
|
||||||
redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1
|
redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1
|
||||||
|
@ -68,7 +68,6 @@ class RolesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index }
|
|
||||||
def destroy
|
def destroy
|
||||||
@role.destroy
|
@role.destroy
|
||||||
redirect_to :action => 'index'
|
redirect_to :action => 'index'
|
||||||
|
@ -121,7 +121,6 @@ class TimelogController < ApplicationController
|
|||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def create
|
def create
|
||||||
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
@ -156,7 +155,6 @@ class TimelogController < ApplicationController
|
|||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def update
|
def update
|
||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
@ -200,7 +198,6 @@ class TimelogController < ApplicationController
|
|||||||
redirect_back_or_default({:controller => 'timelog', :action => 'index', :project_id => @projects.first})
|
redirect_back_or_default({:controller => 'timelog', :action => 'index', :project_id => @projects.first})
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy
|
def destroy
|
||||||
@time_entries.each do |t|
|
@time_entries.each do |t|
|
||||||
begin
|
begin
|
||||||
|
@ -71,7 +71,6 @@ class TrackersController < ApplicationController
|
|||||||
render :action => 'edit'
|
render :action => 'edit'
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index }
|
|
||||||
def destroy
|
def destroy
|
||||||
@tracker = Tracker.find(params[:id])
|
@tracker = Tracker.find(params[:id])
|
||||||
unless @tracker.issues.empty?
|
unless @tracker.issues.empty?
|
||||||
|
@ -86,7 +86,6 @@ class UsersController < ApplicationController
|
|||||||
@auth_sources = AuthSource.find(:all)
|
@auth_sources = AuthSource.find(:all)
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def create
|
def create
|
||||||
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
|
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
|
||||||
@user.safe_attributes = params[:user]
|
@user.safe_attributes = params[:user]
|
||||||
@ -131,7 +130,6 @@ class UsersController < ApplicationController
|
|||||||
@membership ||= Member.new
|
@membership ||= Member.new
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def update
|
def update
|
||||||
@user.admin = params[:user][:admin] if params[:user][:admin]
|
@user.admin = params[:user][:admin] if params[:user][:admin]
|
||||||
@user.login = params[:user][:login] if params[:user][:login]
|
@user.login = params[:user][:login] if params[:user][:login]
|
||||||
@ -177,7 +175,6 @@ class UsersController < ApplicationController
|
|||||||
redirect_to :controller => 'users', :action => 'edit', :id => @user
|
redirect_to :controller => 'users', :action => 'edit', :id => @user
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy
|
def destroy
|
||||||
@user.destroy
|
@user.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
@ -186,7 +183,6 @@ class UsersController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => [:post, :put], :only => :edit_membership, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def edit_membership
|
def edit_membership
|
||||||
@membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
|
@membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
|
||||||
@membership.save
|
@membership.save
|
||||||
@ -209,7 +205,6 @@ class UsersController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy_membership, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy_membership
|
def destroy_membership
|
||||||
@membership = Member.find(params[:membership_id])
|
@membership = Member.find(params[:membership_id])
|
||||||
if @membership.deletable?
|
if @membership.deletable?
|
||||||
|
@ -160,7 +160,6 @@ class VersionsController < ApplicationController
|
|||||||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
|
redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
def destroy
|
def destroy
|
||||||
if @version.fixed_issues.empty?
|
if @version.fixed_issues.empty?
|
||||||
@version.destroy
|
@version.destroy
|
||||||
|
@ -20,10 +20,6 @@ class WatchersController < ApplicationController
|
|||||||
before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch]
|
before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch]
|
||||||
before_filter :authorize, :only => [:new, :destroy]
|
before_filter :authorize, :only => [:new, :destroy]
|
||||||
|
|
||||||
verify :method => :post,
|
|
||||||
:only => [ :watch, :unwatch ],
|
|
||||||
:render => { :nothing => true, :status => :method_not_allowed }
|
|
||||||
|
|
||||||
def watch
|
def watch
|
||||||
if @watched.respond_to?(:visible?) && !@watched.visible?(User.current)
|
if @watched.respond_to?(:visible?) && !@watched.visible?(User.current)
|
||||||
render_403
|
render_403
|
||||||
|
@ -118,7 +118,6 @@ class WikiController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
|
||||||
# Creates a new page or updates an existing one
|
# Creates a new page or updates an existing one
|
||||||
def update
|
def update
|
||||||
return render_403 unless editable?
|
return render_403 unless editable?
|
||||||
@ -178,7 +177,6 @@ class WikiController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :post, :only => :protect, :redirect_to => { :action => :show }
|
|
||||||
def protect
|
def protect
|
||||||
@page.update_attribute :protected, params[:protected]
|
@page.update_attribute :protected, params[:protected]
|
||||||
redirect_to :action => 'show', :project_id => @project, :id => @page.title
|
redirect_to :action => 'show', :project_id => @project, :id => @page.title
|
||||||
@ -208,7 +206,6 @@ class WikiController < ApplicationController
|
|||||||
render_404 unless @annotate
|
render_404 unless @annotate
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :delete, :only => [:destroy], :redirect_to => { :action => :show }
|
|
||||||
# Removes a wiki page and its history
|
# Removes a wiki page and its history
|
||||||
# Children can be either set as root pages, removed or reassigned to another parent page
|
# Children can be either set as root pages, removed or reassigned to another parent page
|
||||||
def destroy
|
def destroy
|
||||||
|
@ -2138,20 +2138,6 @@ class IssuesControllerTest < ActionController::TestCase
|
|||||||
assert_equal 'This is the test_new issue', issue.subject
|
assert_equal 'This is the test_new issue', issue.subject
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_update_using_invalid_http_verbs
|
|
||||||
@request.session[:user_id] = 2
|
|
||||||
subject = 'Updated by an invalid http verb'
|
|
||||||
|
|
||||||
get :update, :id => 1, :issue => {:subject => subject}
|
|
||||||
assert_not_equal subject, Issue.find(1).subject
|
|
||||||
|
|
||||||
post :update, :id => 1, :issue => {:subject => subject}
|
|
||||||
assert_not_equal subject, Issue.find(1).subject
|
|
||||||
|
|
||||||
delete :update, :id => 1, :issue => {:subject => subject}
|
|
||||||
assert_not_equal subject, Issue.find(1).subject
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_put_update_without_custom_fields_param
|
def test_put_update_without_custom_fields_param
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
|
@ -311,12 +311,6 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_should_not_accept_get
|
|
||||||
@request.session[:user_id] = 1
|
|
||||||
get :create
|
|
||||||
assert_response :method_not_allowed
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_show_by_id
|
def test_show_by_id
|
||||||
get :show, :id => 1
|
get :show, :id => 1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -412,12 +406,6 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||||||
assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort
|
assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_modules_should_not_allow_get
|
|
||||||
@request.session[:user_id] = 1
|
|
||||||
get :modules, :id => 1
|
|
||||||
assert_response :method_not_allowed
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_destroy_without_confirmation
|
def test_destroy_without_confirmation
|
||||||
@request.session[:user_id] = 1 # admin
|
@request.session[:user_id] = 1 # admin
|
||||||
delete :destroy, :id => 1
|
delete :destroy, :id => 1
|
||||||
|
@ -289,13 +289,6 @@ class UsersControllerTest < ActionController::TestCase
|
|||||||
assert_nil User.find_by_id(2)
|
assert_nil User.find_by_id(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_should_not_accept_get_requests
|
|
||||||
assert_no_difference 'User.count' do
|
|
||||||
get :destroy, :id => 2
|
|
||||||
end
|
|
||||||
assert_response 405
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_destroy_should_be_denied_for_non_admin_users
|
def test_destroy_should_be_denied_for_non_admin_users
|
||||||
@request.session[:user_id] = 3
|
@request.session[:user_id] = 3
|
||||||
|
|
||||||
|
@ -32,12 +32,6 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
User.current = nil
|
User.current = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_watch_should_be_invalid
|
|
||||||
@request.session[:user_id] = 3
|
|
||||||
get :watch, :object_type => 'issue', :object_id => '1'
|
|
||||||
assert_response 405
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_watch
|
def test_watch
|
||||||
@request.session[:user_id] = 3
|
@request.session[:user_id] = 3
|
||||||
assert_difference('Watcher.count') do
|
assert_difference('Watcher.count') do
|
||||||
|
@ -206,4 +206,23 @@ class IssuesTest < ActionController::IntegrationTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_update_using_invalid_http_verbs
|
||||||
|
subject = 'Updated by an invalid http verb'
|
||||||
|
|
||||||
|
get '/issues/update/1', {:issue => {:subject => subject}}, credentials('jsmith')
|
||||||
|
assert_response 404
|
||||||
|
assert_not_equal subject, Issue.find(1).subject
|
||||||
|
|
||||||
|
post '/issues/1', {:issue => {:subject => subject}}, credentials('jsmith')
|
||||||
|
assert_response 405
|
||||||
|
assert_not_equal subject, Issue.find(1).subject
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_get_watch_should_be_invalid
|
||||||
|
assert_no_difference 'Watcher.count' do
|
||||||
|
get '/watchers/watch?object_type=issue&object_id=1', {}, credentials('jsmith')
|
||||||
|
assert_response 405
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
require File.expand_path('../../test_helper', __FILE__)
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
class ProjectsTest < ActionController::IntegrationTest
|
class ProjectsTest < ActionController::IntegrationTest
|
||||||
fixtures :projects, :users, :members
|
fixtures :projects, :users, :members, :enabled_modules
|
||||||
|
|
||||||
def test_archive_project
|
def test_archive_project
|
||||||
subproject = Project.find(1).children.first
|
subproject = Project.find(1).children.first
|
||||||
@ -41,4 +41,11 @@ class ProjectsTest < ActionController::IntegrationTest
|
|||||||
get "projects/1"
|
get "projects/1"
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_modules_should_not_allow_get
|
||||||
|
assert_no_difference 'EnabledModule.count' do
|
||||||
|
get '/projects/1/modules', {:enabled_module_names => ['']}, credentials('jsmith')
|
||||||
|
assert_response :method_not_allowed
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
29
test/integration/users_test.rb
Normal file
29
test/integration/users_test.rb
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Redmine - project management software
|
||||||
|
# Copyright (C) 2006-2012 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.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
|
class USersTest < ActionController::IntegrationTest
|
||||||
|
fixtures :users
|
||||||
|
|
||||||
|
def test_destroy_should_not_accept_get_requests
|
||||||
|
assert_no_difference 'User.count' do
|
||||||
|
get '/users/destroy/2', {}, credentials('admin')
|
||||||
|
assert_response 404
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user