cleanup: rubocop: fix Layout/AlignArguments in test/integration/api_test/files_test.rb

git-svn-id: http://svn.redmine.org/redmine/trunk@18950 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2019-11-08 06:27:01 +00:00
parent 2efe9dc610
commit 6cc77bd4a1

View File

@@ -37,9 +37,10 @@ class Redmine::ApiTest::FilesTest < Redmine::ApiTest::Base
test "POST /projects/:project_id/files.json should create a file" do test "POST /projects/:project_id/files.json should create a file" do
set_tmp_attachments_directory set_tmp_attachments_directory
post '/uploads.xml', post(
'/uploads.xml',
:params => 'File content', :params => 'File content',
:headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith')))
token = Attachment.last.token token = Attachment.last.token
payload = <<~JSON payload = <<~JSON
{ "file": { { "file": {
@@ -47,9 +48,10 @@ class Redmine::ApiTest::FilesTest < Redmine::ApiTest::Base
} }
} }
JSON JSON
post '/projects/1/files.json', post(
'/projects/1/files.json',
:params => payload, :params => payload,
:headers => {"CONTENT_TYPE" => 'application/json'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/json'}.merge(credentials('jsmith')))
assert_response :success assert_response :success
assert_equal 1, Attachment.last.container_id assert_equal 1, Attachment.last.container_id
assert_equal "Project", Attachment.last.container_type assert_equal "Project", Attachment.last.container_type
@@ -57,18 +59,20 @@ class Redmine::ApiTest::FilesTest < Redmine::ApiTest::Base
test "POST /projects/:project_id/files.xml should create a file" do test "POST /projects/:project_id/files.xml should create a file" do
set_tmp_attachments_directory set_tmp_attachments_directory
post '/uploads.xml', post(
'/uploads.xml',
:params => 'File content', :params => 'File content',
:headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith')))
token = Attachment.last.token token = Attachment.last.token
payload = <<~XML payload = <<~XML
<file> <file>
<token>#{token}</token> <token>#{token}</token>
</file> </file>
XML XML
post '/projects/1/files.xml', post(
'/projects/1/files.xml',
:params => payload, :params => payload,
:headers => {"CONTENT_TYPE" => 'application/xml'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/xml'}.merge(credentials('jsmith')))
assert_response :success assert_response :success
assert_equal 1, Attachment.last.container_id assert_equal 1, Attachment.last.container_id
assert_equal "Project", Attachment.last.container_type assert_equal "Project", Attachment.last.container_type
@@ -81,17 +85,19 @@ class Redmine::ApiTest::FilesTest < Redmine::ApiTest::Base
} }
} }
JSON JSON
post '/projects/1/files.json', post(
'/projects/1/files.json',
:params => payload, :params => payload,
:headers => {"CONTENT_TYPE" => 'application/json'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/json'}.merge(credentials('jsmith')))
assert_response :bad_request assert_response :bad_request
end end
test "POST /projects/:project_id/files.json should accept :filename, :description, :content_type as optional parameters" do test "POST /projects/:project_id/files.json should accept :filename, :description, :content_type as optional parameters" do
set_tmp_attachments_directory set_tmp_attachments_directory
post '/uploads.xml', post(
'/uploads.xml',
:params => 'File content', :params => 'File content',
:headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith')))
token = Attachment.last.token token = Attachment.last.token
payload = <<~JSON payload = <<~JSON
{ "file": { { "file": {
@@ -102,9 +108,10 @@ class Redmine::ApiTest::FilesTest < Redmine::ApiTest::Base
} }
} }
JSON JSON
post '/projects/1/files.json', post(
'/projects/1/files.json',
:params => payload, :params => payload,
:headers => {"CONTENT_TYPE" => 'application/json'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/json'}.merge(credentials('jsmith')))
assert_response :success assert_response :success
assert_equal "New filename", Attachment.last.filename assert_equal "New filename", Attachment.last.filename
assert_equal "New description", Attachment.last.description assert_equal "New description", Attachment.last.description
@@ -113,9 +120,10 @@ class Redmine::ApiTest::FilesTest < Redmine::ApiTest::Base
test "POST /projects/:project_id/files.json should accept :version_id to attach the files to a version" do test "POST /projects/:project_id/files.json should accept :version_id to attach the files to a version" do
set_tmp_attachments_directory set_tmp_attachments_directory
post '/uploads.xml', post(
'/uploads.xml',
:params => 'File content', :params => 'File content',
:headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith')))
token = Attachment.last.token token = Attachment.last.token
payload = <<~JSON payload = <<~JSON
{ "file": { { "file": {
@@ -126,9 +134,10 @@ class Redmine::ApiTest::FilesTest < Redmine::ApiTest::Base
} }
} }
JSON JSON
post '/projects/1/files.json', post(
'/projects/1/files.json',
:params => payload, :params => payload,
:headers => {"CONTENT_TYPE" => 'application/json'}.merge(credentials('jsmith')) :headers => {"CONTENT_TYPE" => 'application/json'}.merge(credentials('jsmith')))
assert_equal 3, Attachment.last.container_id assert_equal 3, Attachment.last.container_id
assert_equal "Version", Attachment.last.container_type assert_equal "Version", Attachment.last.container_type
end end