summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2024-04-28 07:26:29 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2024-04-28 07:26:29 +0000
commit61c7d539dccc3bec3da4d365443fb780bffd8ef0 (patch)
treed891c694b86e76ead3a95eb56ad37b4b633994f2 /test
parentab2f00f2ebf34931f6fa9e67751535bb6cb0b728 (diff)
downloadredmine-61c7d539dccc3bec3da4d365443fb780bffd8ef0.tar.gz
redmine-61c7d539dccc3bec3da4d365443fb780bffd8ef0.zip
Adds Watcher list to the list of available query columns for issues (#29894).
Patch by Felix Schäfer (@felix). git-svn-id: https://svn.redmine.org/redmine/trunk@22793 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 014a2d835..7b8147ece 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -1923,6 +1923,67 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_include "\"source.rb\npicture.jpg\"", response.body
end
+ def test_index_with_watchers_column
+ @request.session[:user_id] = 2
+ get(
+ :index,
+ :params => {
+ :c => %w(subject watcher_users),
+ :set_filter => '1',
+ :sort => 'id',
+ }
+ )
+
+ assert_response :success
+ assert_select 'td.watcher_users'
+ assert_select 'tr#issue-2' do
+ assert_select 'td.watcher_users' do
+ assert_select 'a[href=?]', '/users/1', :text => User.find(1).name
+ assert_select 'a[href=?]', '/users/3', :text => User.find(3).name
+ end
+ end
+ end
+
+ def test_index_with_watchers_column_only_visible_watchers
+ @request.session[:user_id] = 3
+ User.find(3).roles.first.remove_permission! :view_issue_watchers
+ get(
+ :index,
+ :params => {
+ :c => %w(subject watcher_users),
+ :set_filter => '1',
+ :sort => 'id',
+ }
+ )
+
+ assert_response :success
+ assert_select 'td.watcher_users'
+ assert_select 'tr#issue-2' do
+ assert_select 'td.watcher_users' do
+ assert_select 'a[href=?]', '/users/1', 0
+ # Currently not implemented, see https://www.redmine.org/issues/29894#note-17
+ # You can only know that you are a watcher yourself
+ # assert_select 'a[href=?]', '/users/3', :text => User.find(3).name
+ end
+ end
+ end
+
+ def test_index_with_watchers_column_as_csv
+ @request.session[:user_id] = 2
+ get(
+ :index,
+ :params => {
+ :c => %w(subject watcher_users),
+ :set_filter => '1',
+ :sort => 'id',
+ :format => 'csv',
+ }
+ )
+
+ assert_response :success
+ assert_include "\"#{User.find(1).name}\n#{User.find(3).name}\"", response.body
+ end
+
def test_index_with_estimated_hours_total
Issue.delete_all
Issue.generate!(:estimated_hours => '5:30')