Redmine 4.1.1

This commit is contained in:
Manuel Cillero 2020-11-22 21:20:06 +01:00
parent 33e7b881a5
commit 3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2006-2019 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -59,20 +61,17 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "GET /attachments/:id.xml should deny access without credentials" do
get '/attachments/7.xml'
assert_response 401
set_tmp_attachments_directory
end
test "GET /attachments/download/:id/:filename should return the attachment content" do
get '/attachments/download/7/archive.zip', :headers => credentials('jsmith')
assert_response :success
assert_equal 'application/zip', @response.content_type
set_tmp_attachments_directory
end
test "GET /attachments/download/:id/:filename should deny access without credentials" do
get '/attachments/download/7/archive.zip'
assert_response 302
set_tmp_attachments_directory
assert_response 401
end
test "GET /attachments/thumbnail/:id should return the thumbnail" do
@ -84,7 +83,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "DELETE /attachments/:id.xml should return ok and delete Attachment" do
assert_difference 'Attachment.count', -1 do
delete '/attachments/7.xml', :headers => credentials('jsmith')
assert_response :ok
assert_response :no_content
assert_equal '', response.body
end
assert_nil Attachment.find_by_id(7)
@ -93,7 +92,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "DELETE /attachments/:id.json should return ok and delete Attachment" do
assert_difference 'Attachment.count', -1 do
delete '/attachments/7.json', :headers => credentials('jsmith')
assert_response :ok
assert_response :no_content
assert_equal '', response.body
end
assert_nil Attachment.find_by_id(7)
@ -104,8 +103,8 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
:params => {:attachment => {:filename => 'renamed.zip', :description => 'updated'}},
:headers => credentials('jsmith')
assert_response :ok
assert_equal 'application/json', response.content_type
assert_response :no_content
assert_nil response.content_type
attachment = Attachment.find(7)
assert_equal 'renamed.zip', attachment.filename
assert_equal 'updated', attachment.description
@ -220,14 +219,11 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
"CONTENT_TYPE" => 'application/octet-stream'
}.merge(credentials('jsmith'))
assert_response :created
end
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Hash, json['upload']
token = json['upload']['token']
assert token.present?
assert attachment = Attachment.find_by_token(token)
assert_equal 0, attachment.filesize
assert attachment.digest.present?