##// END OF EJS Templates
Use upload helper method....
Jean-Philippe Lang -
r13411:e723081ff4df
parent child
Show More
@@ -534,16 +534,8 JSON
534 end
534 end
535
535
536 def test_create_issue_with_uploaded_file
536 def test_create_issue_with_uploaded_file
537 set_tmp_attachments_directory
537 token = xml_upload('test_create_with_upload', credentials('jsmith'))
538 # upload the file
538 attachment = Attachment.find_by_token(token)
539 assert_difference 'Attachment.count' do
540 post '/uploads.xml', 'test_create_with_upload',
541 {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
542 assert_response :created
543 end
544 xml = Hash.from_xml(response.body)
545 token = xml['upload']['token']
546 attachment = Attachment.order('id DESC').first
547
539
548 # create the issue with the upload's token
540 # create the issue with the upload's token
549 assert_difference 'Issue.count' do
541 assert_difference 'Issue.count' do
@@ -577,6 +569,7 JSON
577 # download the attachment
569 # download the attachment
578 get url
570 get url
579 assert_response :success
571 assert_response :success
572 assert_equal 'test_create_with_upload', response.body
580 end
573 end
581
574
582 def test_create_issue_with_multiple_uploaded_files_as_xml
575 def test_create_issue_with_multiple_uploaded_files_as_xml
@@ -637,16 +630,8 JSON
637 end
630 end
638
631
639 def test_update_issue_with_uploaded_file
632 def test_update_issue_with_uploaded_file
640 set_tmp_attachments_directory
633 token = xml_upload('test_upload_with_upload', credentials('jsmith'))
641 # upload the file
634 attachment = Attachment.find_by_token(token)
642 assert_difference 'Attachment.count' do
643 post '/uploads.xml', 'test_upload_with_upload',
644 {"CONTENT_TYPE" => 'application/octet-stream'}.merge(credentials('jsmith'))
645 assert_response :created
646 end
647 xml = Hash.from_xml(response.body)
648 token = xml['upload']['token']
649 attachment = Attachment.order('id DESC').first
650
635
651 # update the issue with the upload's token
636 # update the issue with the upload's token
652 assert_difference 'Journal.count' do
637 assert_difference 'Journal.count' do
General Comments 0
You need to be logged in to leave comments. Login now