summaryrefslogtreecommitdiffstats
path: root/test/integration/api_test
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-12-02 13:31:54 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-12-02 13:31:54 +0000
commit5ada8436383c6b6469cd5efb33f9c034c7b7a4e3 (patch)
tree30d5a06047fb2c07fbf0321a9b2fa87d855671fb /test/integration/api_test
parentf3789eed52979878bee574cdd97079f5f597b697 (diff)
downloadredmine-5ada8436383c6b6469cd5efb33f9c034c7b7a4e3.tar.gz
redmine-5ada8436383c6b6469cd5efb33f9c034c7b7a4e3.zip
fix source indent of test/integration/api_test/attachments_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20543 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/api_test')
-rw-r--r--test/integration/api_test/attachments_test.rb30
1 files changed, 24 insertions, 6 deletions
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb
index a9775745c..49a8fa91d 100644
--- a/test/integration/api_test/attachments_test.rb
+++ b/test/integration/api_test/attachments_test.rb
@@ -127,10 +127,13 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "POST /uploads.xml should return the token" do
set_tmp_attachments_directory
assert_difference 'Attachment.count' do
- post '/uploads.xml', :headers => {
+ post(
+ '/uploads.xml',
+ :headers => {
"RAW_POST_DATA" => 'File content',
"CONTENT_TYPE" => 'application/octet-stream'
}.merge(credentials('jsmith'))
+ )
assert_response :created
assert_equal 'application/xml', response.media_type
end
@@ -158,10 +161,13 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "POST /uploads.json should return the token" do
set_tmp_attachments_directory
assert_difference 'Attachment.count' do
- post '/uploads.json', :headers => {
+ post(
+ '/uploads.json',
+ :headers => {
"RAW_POST_DATA" => 'File content',
"CONTENT_TYPE" => 'application/octet-stream'
}.merge(credentials('jsmith'))
+ )
assert_response :created
assert_equal 'application/json', response.media_type
end
@@ -178,10 +184,13 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "POST /uploads.xml should accept :filename param as the attachment filename" do
set_tmp_attachments_directory
assert_difference 'Attachment.count' do
- post '/uploads.xml?filename=test.txt', :headers => {
+ post(
+ '/uploads.xml?filename=test.txt',
+ :headers => {
"RAW_POST_DATA" => 'File content',
"CONTENT_TYPE" => 'application/octet-stream'
}.merge(credentials('jsmith'))
+ )
assert_response :created
end
@@ -193,10 +202,13 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "POST /uploads.xml should not accept other content types" do
set_tmp_attachments_directory
assert_no_difference 'Attachment.count' do
- post '/uploads.xml', :headers => {
+ post(
+ '/uploads.xml',
+ :headers => {
"RAW_POST_DATA" => 'PNG DATA',
"CONTENT_TYPE" => 'image/png'
}.merge(credentials('jsmith'))
+ )
assert_response 406
end
end
@@ -205,10 +217,13 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
set_tmp_attachments_directory
with_settings :attachment_max_size => 1 do
assert_no_difference 'Attachment.count' do
- post '/uploads.xml', :headers => {
+ post(
+ '/uploads.xml',
+ :headers => {
"RAW_POST_DATA" => ('x' * 2048),
"CONTENT_TYPE" => 'application/octet-stream'
}.merge(credentials('jsmith'))
+ )
assert_response 422
assert_select 'error', :text => /exceeds the maximum allowed file size/
end
@@ -218,9 +233,12 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "POST /uploads.json should create an empty file and return a valid token" do
set_tmp_attachments_directory
assert_difference 'Attachment.count' do
- post '/uploads.json', :headers => {
+ post(
+ '/uploads.json',
+ :headers => {
"CONTENT_TYPE" => 'application/octet-stream'
}.merge(credentials('jsmith'))
+ )
assert_response :created
end
json = ActiveSupport::JSON.decode(response.body)