mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-03 23:53:23 +00:00
Support for deleting attachments via API (#14828).
Patch by Takenori TAKAKI. git-svn-id: http://svn.redmine.org/redmine/trunk@15332 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
dfb78be2a7
commit
130424fc3e
@ -22,7 +22,7 @@ class AttachmentsController < ApplicationController
|
||||
before_filter :delete_authorize, :only => :destroy
|
||||
before_filter :authorize_global, :only => :upload
|
||||
|
||||
accept_api_auth :show, :download, :thumbnail, :upload
|
||||
accept_api_auth :show, :download, :thumbnail, :upload, :destroy
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
@ -130,6 +130,7 @@ class AttachmentsController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or project_path(@project) }
|
||||
format.js
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -81,6 +81,24 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "Destroy /attachments/:id.xml should return ok and deleted Attachment" do
|
||||
assert_difference 'Attachment.count', -1 do
|
||||
delete '/attachments/7.xml', {}, credentials('jsmith')
|
||||
assert_response :ok
|
||||
assert_equal '', response.body
|
||||
end
|
||||
assert_nil Attachment.find_by_id(7)
|
||||
end
|
||||
|
||||
test "Destroy /attachments/:id.json should return ok and deleted Attachment" do
|
||||
assert_difference 'Attachment.count', -1 do
|
||||
delete '/attachments/7.json', {}, credentials('jsmith')
|
||||
assert_response :ok
|
||||
assert_equal '', response.body
|
||||
end
|
||||
assert_nil Attachment.find_by_id(7)
|
||||
end
|
||||
|
||||
test "POST /uploads.xml should return the token" do
|
||||
set_tmp_attachments_directory
|
||||
assert_difference 'Attachment.count' do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user