summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-12-20 08:51:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-12-20 08:51:01 +0000
commit7d6fe34c52ecbda0df84e2b6ffad897f8dd4915f (patch)
tree709f180d97553d61a37bad4234549678590cb314 /test
parent9db3386da4602ed3b1f991ce6caeacd1bb94a6fc (diff)
downloadredmine-7d6fe34c52ecbda0df84e2b6ffad897f8dd4915f.tar.gz
redmine-7d6fe34c52ecbda0df84e2b6ffad897f8dd4915f.zip
Merged r19381 to 4.1-stable (#21766).
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@19387 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/imports_controller_test.rb3
-rw-r--r--test/unit/issue_import_test.rb28
2 files changed, 30 insertions, 1 deletions
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb
index 77bc6723f..6b22bb19a 100644
--- a/test/functional/imports_controller_test.rb
+++ b/test/functional/imports_controller_test.rb
@@ -44,9 +44,10 @@ class ImportsControllerTest < Redmine::ControllerTest
end
def test_new_should_display_the_upload_form
- get :new, :params => { :type => 'IssueImport' }
+ get :new, :params => { :type => 'IssueImport', :project_id => 'subproject1' }
assert_response :success
assert_select 'input[name=?]', 'file'
+ assert_select 'input[name=?][type=?][value=?]', 'project_id', 'hidden', 'subproject1'
end
def test_create_should_save_the_file
diff --git a/test/unit/issue_import_test.rb b/test/unit/issue_import_test.rb
index 8404a0ec1..7068f46e3 100644
--- a/test/unit/issue_import_test.rb
+++ b/test/unit/issue_import_test.rb
@@ -266,4 +266,32 @@ class IssueImportTest < ActiveSupport::TestCase
issues = new_records(Issue, 3) { import.run }
assert [nil, 3, system_version.id], issues.map(&:fixed_version_id)
end
+
+ def test_set_default_settings_with_project_id
+ import = Import.new
+ import.set_default_settings(:project_id => 3)
+
+ assert_equal 3, import.mapping['project_id']
+ end
+
+ def test_set_default_settings_with_project_identifier
+ import = Import.new
+ import.set_default_settings(:project_id => 'ecookbook')
+
+ assert_equal 1, import.mapping['project_id']
+ end
+
+ def test_set_default_settings_without_project_id
+ import = Import.new
+ import.set_default_settings
+
+ assert_empty import.mapping
+ end
+
+ def test_set_default_settings_with_invalid_project_should_not_fail
+ import = Import.new
+ import.set_default_settings(:project_id => 'abc')
+
+ assert_empty import.mapping
+ end
end