summaryrefslogtreecommitdiffstats
path: root/test/integration/api_test/issues_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-22 14:14:36 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-22 14:14:36 +0000
commite723081ff4df9fa4002729add73316f74c4085b9 (patch)
tree4fcc83fc9beda627f7e4e15d91832d79421c71fe /test/integration/api_test/issues_test.rb
parent3fe8197d73234ea68dd50b96002ad78b4ee58463 (diff)
downloadredmine-e723081ff4df9fa4002729add73316f74c4085b9.tar.gz
redmine-e723081ff4df9fa4002729add73316f74c4085b9.zip
Use upload helper method.
git-svn-id: http://svn.redmine.org/redmine/trunk@13793 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/api_test/issues_test.rb')
-rw-r--r--test/integration/api_test/issues_test.rb25
1 files changed, 5 insertions, 20 deletions
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb
index 1686867ba..d14c29171 100644
--- a/test/integration/api_test/issues_test.rb
+++ b/test/integration/api_test/issues_test.rb
@@ -534,16 +534,8 @@ JSON
end
def test_create_issue_with_uploaded_file
- set_tmp_attachments_directory
- # upload the file
- assert_difference 'Attachment.count' do
- post '/uploads.xml', 'test_create_with_upload',
- {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
- assert_response :created
- end
- xml = Hash.from_xml(response.body)
- token = xml['upload']['token']
- attachment = Attachment.order('id DESC').first
+ token = xml_upload('test_create_with_upload', credentials('jsmith'))
+ attachment = Attachment.find_by_token(token)
# create the issue with the upload's token
assert_difference 'Issue.count' do
@@ -577,6 +569,7 @@ JSON
# download the attachment
get url
assert_response :success
+ assert_equal 'test_create_with_upload', response.body
end
def test_create_issue_with_multiple_uploaded_files_as_xml
@@ -637,16 +630,8 @@ JSON
end
def test_update_issue_with_uploaded_file
- set_tmp_attachments_directory
- # upload the file
- assert_difference 'Attachment.count' do
- post '/uploads.xml', 'test_upload_with_upload',
- {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
- assert_response :created
- end
- xml = Hash.from_xml(response.body)
- token = xml['upload']['token']
- attachment = Attachment.order('id DESC').first
+ token = xml_upload('test_upload_with_upload', credentials('jsmith'))
+ attachment = Attachment.find_by_token(token)
# update the issue with the upload's token
assert_difference 'Journal.count' do