From 3afd17f83e6cc5c3314c7dab0499d56deda2ec12 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 2 Nov 2019 08:23:35 +0000 Subject: 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 --- test/functional/imports_controller_test.rb | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'test/functional') 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 -- cgit v1.2.3