Allow key authentication when deleting issues (with tests) #6447
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4367 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7d934c984a
commit
c55e060bab
@ -27,7 +27,7 @@ class IssuesController < ApplicationController
|
|||||||
before_filter :find_optional_project, :only => [:index]
|
before_filter :find_optional_project, :only => [:index]
|
||||||
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
||||||
before_filter :build_new_issue_from_params, :only => [:new, :create]
|
before_filter :build_new_issue_from_params, :only => [:new, :create]
|
||||||
accept_key_auth :index, :show, :create, :update
|
accept_key_auth :index, :show, :create, :update, :destroy
|
||||||
|
|
||||||
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
||||||
|
|
||||||
|
@ -301,32 +301,32 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "DELETE /issues/1.xml" do
|
context "DELETE /issues/1.xml" do
|
||||||
setup do
|
should_allow_api_authentication(:delete,
|
||||||
@issue_count = Issue.count
|
'/issues/6.xml',
|
||||||
delete '/issues/1.xml', {}, :authorization => credentials('jsmith')
|
{},
|
||||||
end
|
{:success_code => :ok})
|
||||||
|
|
||||||
should_respond_with :ok
|
|
||||||
should_respond_with_content_type 'application/xml'
|
|
||||||
|
|
||||||
should "delete the issue" do
|
should "delete the issue" do
|
||||||
assert_equal Issue.count, @issue_count -1
|
assert_difference('Issue.count',-1) do
|
||||||
assert_nil Issue.find_by_id(1)
|
delete '/issues/6.xml', {}, :authorization => credentials('jsmith')
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_nil Issue.find_by_id(6)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "DELETE /issues/1.json" do
|
context "DELETE /issues/1.json" do
|
||||||
setup do
|
should_allow_api_authentication(:delete,
|
||||||
@issue_count = Issue.count
|
'/issues/6.json',
|
||||||
delete '/issues/1.json', {}, :authorization => credentials('jsmith')
|
{},
|
||||||
end
|
{:success_code => :ok})
|
||||||
|
|
||||||
should_respond_with :ok
|
|
||||||
should_respond_with_content_type 'application/json'
|
|
||||||
|
|
||||||
should "delete the issue" do
|
should "delete the issue" do
|
||||||
assert_equal Issue.count, @issue_count -1
|
assert_difference('Issue.count',-1) do
|
||||||
assert_nil Issue.find_by_id(1)
|
delete '/issues/6.json', {}, :authorization => credentials('jsmith')
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_nil Issue.find_by_id(6)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user