From f8033a069f99fd9947f05c2f4076bd8f0f575f98 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 24 Aug 2022 13:21:50 +0000 Subject: Use query name as the file name when exporting queries (#16207). Patch by Mizuki ISHIKAWA. git-svn-id: https://svn.redmine.org/redmine/trunk@21773 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/issues_controller_test.rb | 26 ++++++++++++++++++++++++++ test/functional/timelog_controller_test.rb | 12 ++++++++++++ 2 files changed, 38 insertions(+) (limited to 'test/functional') diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 9028141f3..859fb2ff7 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -850,6 +850,18 @@ class IssuesControllerTest < Redmine::ControllerTest assert_equal Setting.issue_list_default_columns.size + 2, lines[0].split(',').size end + def test_index_csv_filename_without_query_name_param + get :index, :params => {:format => 'csv'} + assert_response :success + assert_match /issues.csv/, @response.headers['Content-Disposition'] + end + + def test_index_csv_filename_with_query_name_param + get :index, :params => {:query_name => 'My Query Name', :format => 'csv'} + assert_response :success + assert_match /my_query_name\.csv/, @response.headers['Content-Disposition'] + end + def test_index_csv_with_project get( :index, @@ -1182,6 +1194,20 @@ class IssuesControllerTest < Redmine::ControllerTest assert_equal 'application/pdf', @response.media_type end + def test_index_pdf_filename_without_query + get :index, :params => {:format => 'pdf'} + assert_response :success + assert_match /issues.pdf/, @response.headers['Content-Disposition'] + end + + def test_index_pdf_filename_with_query + query = IssueQuery.create!(:name => 'My Query Name', :visibility => IssueQuery::VISIBILITY_PUBLIC) + get :index, :params => {:query_id => query.id, :format => 'pdf'} + + assert_response :success + assert_match /my_query_name\.pdf/, @response.headers['Content-Disposition'] + end + def test_index_atom get( :index, diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index deb75a5bb..d36279d13 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -1690,6 +1690,18 @@ class TimelogControllerTest < Redmine::ControllerTest end end + def test_index_csv_filename_query_name_param + get :index, :params => {:format => 'csv'} + assert_response :success + assert_match /timelog.csv/, @response.headers['Content-Disposition'] + end + + def test_index_csv_filename_with_query_name_param + get :index, :params => {:query_name => 'My Query Name', :format => 'csv'} + assert_response :success + assert_match /my_query_name\.csv/, @response.headers['Content-Disposition'] + end + def test_index_csv_should_fill_issue_column_with_tracker_id_and_subject issue = Issue.find(1) entry = TimeEntry.generate!(:issue => issue, :comments => "Issue column content test") -- cgit v1.2.3