@@ -22,7 +22,7 class AttachmentsController < ApplicationController | |||||
22 | before_filter :delete_authorize, :only => :destroy |
|
22 | before_filter :delete_authorize, :only => :destroy | |
23 | before_filter :authorize_global, :only => :upload |
|
23 | before_filter :authorize_global, :only => :upload | |
24 |
|
24 | |||
25 | accept_api_auth :show, :download, :thumbnail, :upload |
|
25 | accept_api_auth :show, :download, :thumbnail, :upload, :destroy | |
26 |
|
26 | |||
27 | def show |
|
27 | def show | |
28 | respond_to do |format| |
|
28 | respond_to do |format| | |
@@ -130,6 +130,7 class AttachmentsController < ApplicationController | |||||
130 | respond_to do |format| |
|
130 | respond_to do |format| | |
131 | format.html { redirect_to_referer_or project_path(@project) } |
|
131 | format.html { redirect_to_referer_or project_path(@project) } | |
132 | format.js |
|
132 | format.js | |
|
133 | format.api { render_api_ok } | |||
133 | end |
|
134 | end | |
134 | end |
|
135 | end | |
135 |
|
136 |
@@ -81,6 +81,24 class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base | |||||
81 | assert_response :success |
|
81 | assert_response :success | |
82 | end |
|
82 | end | |
83 |
|
83 | |||
|
84 | test "Destroy /attachments/:id.xml should return ok and deleted Attachment" do | |||
|
85 | assert_difference 'Attachment.count', -1 do | |||
|
86 | delete '/attachments/7.xml', {}, credentials('jsmith') | |||
|
87 | assert_response :ok | |||
|
88 | assert_equal '', response.body | |||
|
89 | end | |||
|
90 | assert_nil Attachment.find_by_id(7) | |||
|
91 | end | |||
|
92 | ||||
|
93 | test "Destroy /attachments/:id.json should return ok and deleted Attachment" do | |||
|
94 | assert_difference 'Attachment.count', -1 do | |||
|
95 | delete '/attachments/7.json', {}, credentials('jsmith') | |||
|
96 | assert_response :ok | |||
|
97 | assert_equal '', response.body | |||
|
98 | end | |||
|
99 | assert_nil Attachment.find_by_id(7) | |||
|
100 | end | |||
|
101 | ||||
84 | test "POST /uploads.xml should return the token" do |
|
102 | test "POST /uploads.xml should return the token" do | |
85 | set_tmp_attachments_directory |
|
103 | set_tmp_attachments_directory | |
86 | assert_difference 'Attachment.count' do |
|
104 | assert_difference 'Attachment.count' do |
General Comments 0
You need to be logged in to leave comments.
Login now