##// END OF EJS Templates
Adds a routing test for deleting attachment via the API....
Jean-Philippe Lang -
r15480:30fc03ac3259
parent child
Show More
@@ -22,6 +22,7 class Redmine::ApiTest::ApiRoutingTest < Redmine::ApiTest::Routing
22 def test_attachments
22 def test_attachments
23 should_route 'GET /attachments/1' => 'attachments#show', :id => '1'
23 should_route 'GET /attachments/1' => 'attachments#show', :id => '1'
24 should_route 'PATCH /attachments/1' => 'attachments#update', :id => '1'
24 should_route 'PATCH /attachments/1' => 'attachments#update', :id => '1'
25 should_route 'DELETE /attachments/1' => 'attachments#destroy', :id => '1'
25 should_route 'POST /uploads' => 'attachments#upload'
26 should_route 'POST /uploads' => 'attachments#upload'
26 end
27 end
27
28
@@ -81,7 +81,7 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
84 test "DELETE /attachments/:id.xml should return ok and delete Attachment" do
85 assert_difference 'Attachment.count', -1 do
85 assert_difference 'Attachment.count', -1 do
86 delete '/attachments/7.xml', {}, credentials('jsmith')
86 delete '/attachments/7.xml', {}, credentials('jsmith')
87 assert_response :ok
87 assert_response :ok
@@ -90,7 +90,7 class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
90 assert_nil Attachment.find_by_id(7)
90 assert_nil Attachment.find_by_id(7)
91 end
91 end
92
92
93 test "Destroy /attachments/:id.json should return ok and deleted Attachment" do
93 test "DELETE /attachments/:id.json should return ok and delete Attachment" do
94 assert_difference 'Attachment.count', -1 do
94 assert_difference 'Attachment.count', -1 do
95 delete '/attachments/7.json', {}, credentials('jsmith')
95 delete '/attachments/7.json', {}, credentials('jsmith')
96 assert_response :ok
96 assert_response :ok
General Comments 0
You need to be logged in to leave comments. Login now