##// END OF EJS Templates
Allow key authentication when deleting issues (with tests) #6447...
Eric Davis -
r4253:c55e060bab62
parent child
Show More
@@ -27,7 +27,7 class IssuesController < ApplicationController
27 before_filter :find_optional_project, :only => [:index]
27 before_filter :find_optional_project, :only => [:index]
28 before_filter :check_for_default_issue_status, :only => [:new, :create]
28 before_filter :check_for_default_issue_status, :only => [:new, :create]
29 before_filter :build_new_issue_from_params, :only => [:new, :create]
29 before_filter :build_new_issue_from_params, :only => [:new, :create]
30 accept_key_auth :index, :show, :create, :update
30 accept_key_auth :index, :show, :create, :update, :destroy
31
31
32 rescue_from Query::StatementInvalid, :with => :query_statement_invalid
32 rescue_from Query::StatementInvalid, :with => :query_statement_invalid
33
33
@@ -301,32 +301,32 class ApiTest::IssuesTest < ActionController::IntegrationTest
301 end
301 end
302
302
303 context "DELETE /issues/1.xml" do
303 context "DELETE /issues/1.xml" do
304 setup do
304 should_allow_api_authentication(:delete,
305 @issue_count = Issue.count
305 '/issues/6.xml',
306 delete '/issues/1.xml', {}, :authorization => credentials('jsmith')
306 {},
307 end
307 {:success_code => :ok})
308
309 should_respond_with :ok
310 should_respond_with_content_type 'application/xml'
311
308
312 should "delete the issue" do
309 should "delete the issue" do
313 assert_equal Issue.count, @issue_count -1
310 assert_difference('Issue.count',-1) do
314 assert_nil Issue.find_by_id(1)
311 delete '/issues/6.xml', {}, :authorization => credentials('jsmith')
312 end
313
314 assert_nil Issue.find_by_id(6)
315 end
315 end
316 end
316 end
317
317
318 context "DELETE /issues/1.json" do
318 context "DELETE /issues/1.json" do
319 setup do
319 should_allow_api_authentication(:delete,
320 @issue_count = Issue.count
320 '/issues/6.json',
321 delete '/issues/1.json', {}, :authorization => credentials('jsmith')
321 {},
322 end
322 {:success_code => :ok})
323
324 should_respond_with :ok
325 should_respond_with_content_type 'application/json'
326
323
327 should "delete the issue" do
324 should "delete the issue" do
328 assert_equal Issue.count, @issue_count -1
325 assert_difference('Issue.count',-1) do
329 assert_nil Issue.find_by_id(1)
326 delete '/issues/6.json', {}, :authorization => credentials('jsmith')
327 end
328
329 assert_nil Issue.find_by_id(6)
330 end
330 end
331 end
331 end
332
332
General Comments 0
You need to be logged in to leave comments. Login now