mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 17:56:03 +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
|
test "POST /uploads.xml should return the token" do
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
assert_difference 'Attachment.count' do
|
assert_difference 'Attachment.count' do
|
||||||
post '/uploads.xml', :headers => {
|
post(
|
||||||
|
'/uploads.xml',
|
||||||
|
:headers => {
|
||||||
"RAW_POST_DATA" => 'File content',
|
"RAW_POST_DATA" => 'File content',
|
||||||
"CONTENT_TYPE" => 'application/octet-stream'
|
"CONTENT_TYPE" => 'application/octet-stream'
|
||||||
}.merge(credentials('jsmith'))
|
}.merge(credentials('jsmith'))
|
||||||
|
)
|
||||||
assert_response :created
|
assert_response :created
|
||||||
assert_equal 'application/xml', response.media_type
|
assert_equal 'application/xml', response.media_type
|
||||||
end
|
end
|
||||||
@@ -158,10 +161,13 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
|
|||||||
test "POST /uploads.json should return the token" do
|
test "POST /uploads.json should return the token" do
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
assert_difference 'Attachment.count' do
|
assert_difference 'Attachment.count' do
|
||||||
post '/uploads.json', :headers => {
|
post(
|
||||||
|
'/uploads.json',
|
||||||
|
:headers => {
|
||||||
"RAW_POST_DATA" => 'File content',
|
"RAW_POST_DATA" => 'File content',
|
||||||
"CONTENT_TYPE" => 'application/octet-stream'
|
"CONTENT_TYPE" => 'application/octet-stream'
|
||||||
}.merge(credentials('jsmith'))
|
}.merge(credentials('jsmith'))
|
||||||
|
)
|
||||||
assert_response :created
|
assert_response :created
|
||||||
assert_equal 'application/json', response.media_type
|
assert_equal 'application/json', response.media_type
|
||||||
end
|
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
|
test "POST /uploads.xml should accept :filename param as the attachment filename" do
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
assert_difference 'Attachment.count' do
|
assert_difference 'Attachment.count' do
|
||||||
post '/uploads.xml?filename=test.txt', :headers => {
|
post(
|
||||||
|
'/uploads.xml?filename=test.txt',
|
||||||
|
:headers => {
|
||||||
"RAW_POST_DATA" => 'File content',
|
"RAW_POST_DATA" => 'File content',
|
||||||
"CONTENT_TYPE" => 'application/octet-stream'
|
"CONTENT_TYPE" => 'application/octet-stream'
|
||||||
}.merge(credentials('jsmith'))
|
}.merge(credentials('jsmith'))
|
||||||
|
)
|
||||||
assert_response :created
|
assert_response :created
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -193,10 +202,13 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
|
|||||||
test "POST /uploads.xml should not accept other content types" do
|
test "POST /uploads.xml should not accept other content types" do
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
assert_no_difference 'Attachment.count' do
|
assert_no_difference 'Attachment.count' do
|
||||||
post '/uploads.xml', :headers => {
|
post(
|
||||||
|
'/uploads.xml',
|
||||||
|
:headers => {
|
||||||
"RAW_POST_DATA" => 'PNG DATA',
|
"RAW_POST_DATA" => 'PNG DATA',
|
||||||
"CONTENT_TYPE" => 'image/png'
|
"CONTENT_TYPE" => 'image/png'
|
||||||
}.merge(credentials('jsmith'))
|
}.merge(credentials('jsmith'))
|
||||||
|
)
|
||||||
assert_response 406
|
assert_response 406
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -205,10 +217,13 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
|
|||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
with_settings :attachment_max_size => 1 do
|
with_settings :attachment_max_size => 1 do
|
||||||
assert_no_difference 'Attachment.count' do
|
assert_no_difference 'Attachment.count' do
|
||||||
post '/uploads.xml', :headers => {
|
post(
|
||||||
|
'/uploads.xml',
|
||||||
|
:headers => {
|
||||||
"RAW_POST_DATA" => ('x' * 2048),
|
"RAW_POST_DATA" => ('x' * 2048),
|
||||||
"CONTENT_TYPE" => 'application/octet-stream'
|
"CONTENT_TYPE" => 'application/octet-stream'
|
||||||
}.merge(credentials('jsmith'))
|
}.merge(credentials('jsmith'))
|
||||||
|
)
|
||||||
assert_response 422
|
assert_response 422
|
||||||
assert_select 'error', :text => /exceeds the maximum allowed file size/
|
assert_select 'error', :text => /exceeds the maximum allowed file size/
|
||||||
end
|
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
|
test "POST /uploads.json should create an empty file and return a valid token" do
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
assert_difference 'Attachment.count' do
|
assert_difference 'Attachment.count' do
|
||||||
post '/uploads.json', :headers => {
|
post(
|
||||||
|
'/uploads.json',
|
||||||
|
:headers => {
|
||||||
"CONTENT_TYPE" => 'application/octet-stream'
|
"CONTENT_TYPE" => 'application/octet-stream'
|
||||||
}.merge(credentials('jsmith'))
|
}.merge(credentials('jsmith'))
|
||||||
|
)
|
||||||
assert_response :created
|
assert_response :created
|
||||||
end
|
end
|
||||||
json = ActiveSupport::JSON.decode(response.body)
|
json = ActiveSupport::JSON.decode(response.body)
|
||||||
|
|||||||
Reference in New Issue
Block a user