diff options
author | Go MAEDA <maeda@farend.jp> | 2021-06-20 13:25:10 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2021-06-20 13:25:10 +0000 |
commit | 685bfdd8ff94f022870eca580e1193d2cb121a58 (patch) | |
tree | b8bcbfd4eda43f040414a7242d2f2333f2bd7a83 /test/functional/imports_controller_test.rb | |
parent | ffc9101e237ba711f5ad60a959d2254f3273d1c6 (diff) | |
download | redmine-685bfdd8ff94f022870eca580e1193d2cb121a58.tar.gz redmine-685bfdd8ff94f022870eca580e1193d2cb121a58.zip |
Reject CSV file without data row when importing (#35137).
Patch by Yuichi HARADA.
git-svn-id: http://svn.redmine.org/redmine/trunk@21041 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/imports_controller_test.rb')
-rw-r--r-- | test/functional/imports_controller_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb index fa1229791..f87fd029f 100644 --- a/test/functional/imports_controller_test.rb +++ b/test/functional/imports_controller_test.rb @@ -180,6 +180,27 @@ class ImportsControllerTest < Redmine::ControllerTest assert_select 'div#flash_error', /The file is not a CSV file or does not match the settings below \([[:print:]]+\)/ end + def test_post_settings_with_no_data_row_should_display_error + import = generate_import('import_issues_no_data_row.csv') + + post( + :settings, + :params => { + :id => import.to_param, + :import_settings => { + :separator => ';', + :wrapper => '"', + :encoding => 'ISO-8859-1' + } + } + ) + assert_response 200 + import.reload + assert_equal 0, import.total_items + + assert_select 'div#flash_error', /The file does not contain any data/ + end + def test_get_mapping_should_display_mapping_form import = generate_import('import_iso8859-1.csv') import.settings = {'separator' => ";", 'wrapper' => '"', 'encoding' => "ISO-8859-1"} |