diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-11-02 08:23:35 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-11-02 08:23:35 +0000 |
commit | 3afd17f83e6cc5c3314c7dab0499d56deda2ec12 (patch) | |
tree | a5ba9f0eeda5f38a6dfdd4b05e6849a751759c57 /test/functional | |
parent | 7c0ecb4703a16b2c4345e8abd7150412ea86d1ce (diff) | |
download | redmine-3afd17f83e6cc5c3314c7dab0499d56deda2ec12.tar.gz redmine-3afd17f83e6cc5c3314c7dab0499d56deda2ec12.zip |
Allow import time entries for other users (#32196).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@18890 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/imports_controller_test.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb index ed9024306..77bc6723f 100644 --- a/test/functional/imports_controller_test.rb +++ b/test/functional/imports_controller_test.rb @@ -187,6 +187,41 @@ class ImportsControllerTest < Redmine::ControllerTest assert_equal '0', mapping['subject'] end + def test_get_mapping_time_entry + Role.find(1).add_permission! :log_time_for_other_users + import = generate_time_entry_import + import.settings = {'separator' => ";", 'wrapper' => '"', 'encoding' => "ISO-8859-1"} + import.save! + + get :mapping, :params => { + :id => import.to_param + } + + assert_response :success + + # 'user_id' field should be available because User#2 has both + # 'import_time_entries' and 'log_time_for_other_users' permissions + assert_select 'select[name=?]', 'import_settings[mapping][user_id]' do + # Current user should be the default value + assert_select 'option[value="value:2"][selected]', :text => User.find(2).name + assert_select 'option[value="value:3"]', :text => User.find(3).name + end + end + + def test_get_mapping_time_entry_for_user_without_log_time_for_other_users_permission + import = generate_time_entry_import + import.settings = {'separator' => ";", 'wrapper' => '"', 'encoding' => "ISO-8859-1"} + import.save! + + get :mapping, :params => { + :id => import.to_param + } + + assert_response :success + + assert_select 'select[name=?]', 'import_settings[mapping][user_id]', 0 + end + def test_get_run import = generate_import_with_mapping |