diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-12-26 11:26:24 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-12-26 11:26:24 +0000 |
commit | 12890945e527c2803ad5a85ca4afbe1017c34025 (patch) | |
tree | 92d49a3a9ec3d13eb520d2b2ee354e55c374f773 /test | |
parent | 0e58ee44ebec53a3ed3319f50b2808b4b48c96b3 (diff) | |
download | redmine-12890945e527c2803ad5a85ca4afbe1017c34025.tar.gz redmine-12890945e527c2803ad5a85ca4afbe1017c34025.zip |
Allow attachment thumbnails from REST API (#18707).
git-svn-id: http://svn.redmine.org/redmine/trunk@13806 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/api_test/attachments_test.rb | 15 | ||||
-rw-r--r-- | test/test_helper.rb | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb index bff956e80..ed6ebec95 100644 --- a/test/integration/api_test/attachments_test.rb +++ b/test/integration/api_test/attachments_test.rb @@ -47,6 +47,15 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base end end + test "GET /attachments/:id.xml for image should include thumbnail_url" do + get '/attachments/16.xml', {}, credentials('jsmith') + assert_response :success + assert_equal 'application/xml', @response.content_type + assert_select 'attachment id:content(16)' do + assert_select '~ thumbnail_url', :text => 'http://www.example.com/attachments/thumbnail/16' + end + end + test "GET /attachments/:id.xml should deny access without credentials" do get '/attachments/7.xml' assert_response 401 @@ -66,6 +75,12 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base set_tmp_attachments_directory end + test "GET /attachments/thumbnail/:id should return the thumbnail" do + skip unless convert_installed? + get '/attachments/thumbnail/16', {}, credentials('jsmith') + assert_response :success + end + test "POST /uploads.xml should return the token" do set_tmp_attachments_directory assert_difference 'Attachment.count' do diff --git a/test/test_helper.rb b/test/test_helper.rb index 22b96a809..bc2d178c1 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -131,6 +131,10 @@ class ActiveSupport::TestCase Redmine::Thumbnail.convert_available? end + def convert_installed? + self.class.convert_installed? + end + # Returns the path to the test +vendor+ repository def self.repository_path(vendor) path = Rails.root.join("tmp/test/#{vendor.downcase}_repository").to_s |