From 855eed1f53774b378e092f4434e293c9c537bc9f Mon Sep 17 00:00:00 2001 From: "karel.picman@lbcfree.net" Date: Wed, 9 Sep 2020 12:00:23 +0200 Subject: [PATCH] #1170 Integration tests' fix --- .../rest_api/dmsf_file_api_test.rb | 36 ++----------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/test/integration/rest_api/dmsf_file_api_test.rb b/test/integration/rest_api/dmsf_file_api_test.rb index 09e01e2c..cfd2442d 100644 --- a/test/integration/rest_api/dmsf_file_api_test.rb +++ b/test/integration/rest_api/dmsf_file_api_test.rb @@ -147,42 +147,10 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest def test_upload_document_exceeded_attachment_max_size Setting.attachment_max_size = '1' - #curl --data-binary "@cat.gif" -H "Content-Type: application/octet-stream" -X POST -u ${1}:${2} http://localhost:3000/projects/12/dmsf/upload.xml?filename=cat.gif + #curl --data-binary "@text.txt" -H "Content-Type: application/octet-stream" -X POST -u ${1}:${2} http://localhost:3000/projects/12/dmsf/upload.xml?filename=text.txt file_content = 'x' * 2.kilobytes post "/projects/#{@project1.id}/dmsf/upload.xml?filename=test.txt&key=#{@token.value}", params: file_content, - headers: { "CONTENT_TYPE" => 'application/octet-stream' } - assert_response :created - assert_equal 'application/xml', response.content_type - # - # - # 2.8bb2564936980e92ceec8a5759ec34a8 - # - xml = Hash.from_xml(response.body) - assert_kind_of Hash, xml['upload'] - ftoken = xml['upload']['token'] - assert_not_nil ftoken - #curl -v -H "Content-Type: application/xml" -X POST --data "@file.xml" -u ${1}:${2} http://localhost:3000/projects/12/dmsf/commit.xml - payload = %{ - - - - test.txt - test.txt - REST API - From API - - #{ftoken} - - } - assert_difference 'DmsfFileRevision.count', +0 do - post "/projects/#{@project1.id}/dmsf/commit.xml?key=#{@token.value}", params: payload, headers: { 'CONTENT_TYPE' => 'application/xml' } - end - # - # - # Size This file cannot be uploaded because it exceeds the maximum allowed file size (1 KB) - # - assert_select 'error', text: 'Size ' + l(:error_attachment_too_big, - max_size: ActiveSupport::NumberHelper.number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)) + headers: { 'CONTENT_TYPE' => 'application/octet-stream' } assert_response :unprocessable_entity end