summaryrefslogtreecommitdiffstats
path: root/test/object_helpers.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-08-14 08:20:32 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-08-14 08:20:32 +0000
commit035edd39c422c9434147a1b0ac457cb9383c9b5b (patch)
tree4b25e158e04068c535e828c04f336c769ac9db9c /test/object_helpers.rb
parent763d5dddde2c7dda03fe529c9dfe0d553669c277 (diff)
downloadredmine-035edd39c422c9434147a1b0ac457cb9383c9b5b.tar.gz
redmine-035edd39c422c9434147a1b0ac457cb9383c9b5b.zip
Import issues from CSV file (#950).
git-svn-id: http://svn.redmine.org/redmine/trunk@14493 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/object_helpers.rb')
-rw-r--r--test/object_helpers.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/object_helpers.rb b/test/object_helpers.rb
index 74f82b68b..82d8d20fc 100644
--- a/test/object_helpers.rb
+++ b/test/object_helpers.rb
@@ -206,6 +206,25 @@ module ObjectHelpers
query.save!
query
end
+
+ def generate_import(fixture_name='import_issues.csv')
+ import = IssueImport.new
+ import.user_id = 2
+ import.file = uploaded_test_file(fixture_name, 'text/csv')
+ import.save!
+ import
+ end
+
+ def generate_import_with_mapping(fixture_name='import_issues.csv')
+ import = generate_import(fixture_name)
+
+ import.settings = {
+ 'separator' => ";", 'wrapper' => '"', 'encoding' => "UTF-8",
+ 'mapping' => {'project_id' => '1', 'tracker_id' => '2', 'subject' => '1'}
+ }
+ import.save!
+ import
+ end
end
module TrackerObjectHelpers