diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2024-06-04 20:04:45 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2024-06-04 20:04:45 +0000 |
commit | 38a8adb2a20c9c6ae57b0633037290c64a34b624 (patch) | |
tree | 3e3a7ca75019c0c8846dc2ac820e8b819ce30aad /test/functional | |
parent | c19176a5c48e33e6bcfe280736092154deb58181 (diff) | |
download | redmine-38a8adb2a20c9c6ae57b0633037290c64a34b624.tar.gz redmine-38a8adb2a20c9c6ae57b0633037290c64a34b624.zip |
Adds description field to custom queries (#9309).
Patch by Go MAEDA (@maeda).
git-svn-id: https://svn.redmine.org/redmine/trunk@22855 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/calendars_controller_test.rb | 7 | ||||
-rw-r--r-- | test/functional/gantts_controller_test.rb | 13 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 3 | ||||
-rw-r--r-- | test/functional/projects_controller_test.rb | 9 | ||||
-rw-r--r-- | test/functional/queries_controller_test.rb | 44 | ||||
-rw-r--r-- | test/functional/timelog_controller_test.rb | 4 | ||||
-rw-r--r-- | test/functional/users_controller_test.rb | 9 |
7 files changed, 83 insertions, 6 deletions
diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb index f77872ea2..134d41cbe 100644 --- a/test/functional/calendars_controller_test.rb +++ b/test/functional/calendars_controller_test.rb @@ -155,15 +155,16 @@ class CalendarsControllerTest < Redmine::ControllerTest end def test_show_should_run_custom_queries - @query = IssueQuery.create!(:name => 'Calendar Query', :visibility => IssueQuery::VISIBILITY_PUBLIC) + query = IssueQuery.create!(:name => 'Calendar Query', :description => 'Description for Calendar Query', :visibility => IssueQuery::VISIBILITY_PUBLIC) get( :show, :params => { - :query_id => @query.id + :query_id => query.id } ) assert_response :success - assert_select 'h2', :text => 'Calendar Query' + assert_select 'h2', :text => query.name + assert_select '#sidebar a.query.selected[title=?]', query.description, :text => query.name end def test_cross_project_calendar diff --git a/test/functional/gantts_controller_test.rb b/test/functional/gantts_controller_test.rb index 821294bba..48dfc8ae7 100644 --- a/test/functional/gantts_controller_test.rb +++ b/test/functional/gantts_controller_test.rb @@ -118,6 +118,19 @@ class GanttsControllerTest < Redmine::ControllerTest assert_response :success end + def test_show_should_run_custom_query + query = IssueQuery.create!(:name => 'Gantt Query', :description => 'Description for Gantt Query', :visibility => IssueQuery::VISIBILITY_PUBLIC) + get( + :show, + :params => { + :query_id => query.id + } + ) + assert_response :success + assert_select 'h2', :text => query.name + assert_select '#sidebar a.query.selected[title=?]', query.description, :text => query.name + end + def test_gantt_should_work_cross_project get :show assert_response :success diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 12ec7a6d5..ca09ee8f1 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -359,7 +359,8 @@ class IssuesControllerTest < Redmine::ControllerTest assert_select 'a.query.selected', 1 # assert link properties assert_select( - 'a.query.selected[href=?]', + 'a.query.selected[title=?][href=?]', + 'Description for Oepn issues by priority and tracker', '/projects/ecookbook/issues?query_id=5', :text => "Open issues by priority and tracker" ) diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index a21b50b07..80773e0d2 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -267,6 +267,14 @@ class ProjectsControllerTest < Redmine::ControllerTest assert_select 'tr#project-4 td.last_activity_date', :text => '' end + def test_index_with_query + query = ProjectQuery.find(11) + get :index, :params => { :query_id => query.id } + assert_response :success + assert_select 'h2', :text => query.name + assert_select '#sidebar a.query.selected[title=?]', query.description, :text => query.name + end + def test_index_should_retrieve_default_query query = ProjectQuery.find(11) ProjectQuery.stubs(:default).returns query @@ -275,6 +283,7 @@ class ProjectsControllerTest < Redmine::ControllerTest @request.session[:user_id] = user_id get :index assert_select 'h2', text: query.name + assert_select '#sidebar a.query.selected[title=?]', query.description, :text => query.name end end diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index 77560e913..7c8b5cd9a 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.rb @@ -328,6 +328,25 @@ class QueriesControllerTest < Redmine::ControllerTest assert_equal [['due_date', 'desc'], ['tracker', 'asc']], query.sort_criteria end + def test_create_with_description + @request.session[:user_id] = 2 + assert_difference '::Query.count', 1 do + post( + :create, + :params => { + :project_id => 'ecookbook', + :query => { + :name => 'test_new_with_description', :description => 'Description for test_new_with_description' + } + } + ) + end + q = Query.find_by_name("test_new_with_description") + assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q + + assert_equal 'Description for test_new_with_description', q.description + end + def test_create_with_failure @request.session[:user_id] = 2 assert_no_difference '::Query.count' do @@ -659,6 +678,14 @@ class QueriesControllerTest < Redmine::ControllerTest end end + def test_edit_description + @request.session[:user_id] = 1 + get(:edit, :params => {:id => 5}) + assert_response :success + + assert_select 'input[name="query[description]"][value=?]', 'Description for Oepn issues by priority and tracker' + end + def test_edit_invalid_query @request.session[:user_id] = 2 get(:edit, :params => {:id => 99}) @@ -744,6 +771,23 @@ class QueriesControllerTest < Redmine::ControllerTest assert Query.find_by_name('test_project_query_updated') end + def test_update_description + @request.session[:user_id] = 1 + q = Query.find(5) + put( + :update, + :params => { + :id => q.id, + :query => { + :name => q.name, + :description => 'query description updated' + } + } + ) + assert_redirected_to :controller => 'issues', :action => 'index', :query_id => q.id + assert_equal 'query description updated', Query.find(5).description + end + def test_update_with_failure @request.session[:user_id] = 1 put( diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 464bf9327..5a63a8c61 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -1682,14 +1682,14 @@ class TimelogControllerTest < Redmine::ControllerTest end def test_index_with_query - query = TimeEntryQuery.new(:project_id => 1, :name => 'Time Entry Query', :visibility => 2) + query = TimeEntryQuery.new(:project_id => 1, :name => 'Time Entry Query', :description => 'Description for Time Entry Query', :visibility => 2) query.save! @request.session[:user_id] = 2 get :index, :params => {:project_id => 'ecookbook', :query_id => query.id} assert_response :success assert_select 'h2', :text => query.name - assert_select '#sidebar a.selected', :text => query.name + assert_select '#sidebar a.query.selected[title=?]', query.description, :text => query.name end def test_index_atom_feed diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 4302f913a..5d6e6b754 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -189,6 +189,15 @@ class UsersControllerTest < Redmine::ControllerTest assert_select 'tr#user-1', 1 end + def test_index_with_query + query = UserQuery.create!(:name => 'My User Query', :description => 'Description for My User Query', :visibility => UserQuery::VISIBILITY_PUBLIC) + get :index, :params => { :query_id => query.id } + assert_response :success + + assert_select 'h2', :text => query.name + assert_select '#sidebar a.query.selected[title=?]', query.description, :text => query.name + end + def test_index_csv with_settings :default_language => 'en' do user = User.logged.status(1).first |