mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 09:46:02 +01:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user