summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-18 21:06:35 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-18 21:06:35 +0000
commit251f263abdc5ee71def60e6fa8cba1f71adb617c (patch)
tree7034d7c1de96037f4e25e23c8e294bc8a984ca96 /test/integration
parent79c1ec7adc3c8fb8591466b04033a5cf4da735be (diff)
downloadredmine-251f263abdc5ee71def60e6fa8cba1f71adb617c.tar.gz
redmine-251f263abdc5ee71def60e6fa8cba1f71adb617c.zip
Let the attachment filename be specified on upload (#12125).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10678 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/attachments_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb
index 4814c047a..11e444195 100644
--- a/test/integration/api_test/attachments_test.rb
+++ b/test/integration/api_test/attachments_test.rb
@@ -117,6 +117,18 @@ class ApiTest::AttachmentsTest < ActionController::IntegrationTest
assert_equal token, attachment.token
end
+ 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', 'File content', {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
+ assert_response :created
+ end
+
+ attachment = Attachment.order('id DESC').first
+ assert_equal 'test.txt', attachment.filename
+ assert_match /_test\.txt$/, attachment.diskfile
+ end
+
test "POST /uploads.xml should not accept other content types" do
set_tmp_attachments_directory
assert_no_difference 'Attachment.count' do