2851 |
2851 |
assert ! query.available_filters["assigned_to_role"][:values].include?(['Anonymous', '5'])
|
2852 |
2852 |
end
|
2853 |
2853 |
|
|
2854 |
def test_available_filters_should_include_author_group_filter
|
|
2855 |
query = IssueQuery.new
|
|
2856 |
assert query.available_filters.key?("author.group")
|
|
2857 |
assert_equal :list, query.available_filters["author.group"][:type]
|
|
2858 |
assert query.available_filters["author.group"][:values].present?
|
|
2859 |
assert_equal Group.givable.sort.map {|g| [g.name, g.id.to_s]},
|
|
2860 |
query.available_filters["author.group"][:values].sort
|
|
2861 |
end
|
|
2862 |
|
|
2863 |
def test_available_filters_should_include_author_role_filter
|
|
2864 |
query = IssueQuery.new
|
|
2865 |
assert query.available_filters.key?("author.role")
|
|
2866 |
assert_equal :list, query.available_filters["author.role"][:type]
|
|
2867 |
|
|
2868 |
assert query.available_filters["author.role"][:values].include?(['Manager', '1'])
|
|
2869 |
assert query.available_filters["author.role"][:values].include?(['Developer', '2'])
|
|
2870 |
assert query.available_filters["author.role"][:values].include?(['Reporter', '3'])
|
|
2871 |
|
|
2872 |
assert_not query.available_filters["author.role"][:values].include?(['Non member', '4'])
|
|
2873 |
assert_not query.available_filters["author.role"][:values].include?(['Anonymous', '5'])
|
|
2874 |
end
|
|
2875 |
|
2854 |
2876 |
def test_available_filters_should_include_custom_field_according_to_user_visibility
|
2855 |
2877 |
visible_field = IssueCustomField.generate!(:is_for_all => true, :is_filter => true, :visible => true)
|
2856 |
2878 |
hidden_field = IssueCustomField.generate!(:is_for_all => true, :is_filter => true, :visible => false, :role_ids => [1])
|
... | ... | |
3021 |
3043 |
assert_query_result [@issue1, @issue2, @issue3, @issue4, @issue5], @query
|
3022 |
3044 |
end
|
3023 |
3045 |
|
|
3046 |
def test_author_group_filter_should_return_issues_with_or_without_author_in_group
|
|
3047 |
project = Project.generate!
|
|
3048 |
author = User.generate!
|
|
3049 |
author_group = Group.generate!
|
|
3050 |
not_author_group = Group.generate!
|
|
3051 |
author.groups << author_group
|
|
3052 |
issues = 3.times.collect { Issue.generate!(:project => project, :author => author) }
|
|
3053 |
|
|
3054 |
query = IssueQuery.new(:name => '_', :project => project)
|
|
3055 |
query.add_filter('author_group', '=', [author_group.id.to_s])
|
|
3056 |
assert_equal 3, query.issues.count
|
|
3057 |
assert_query_result issues, query
|
|
3058 |
|
|
3059 |
query = IssueQuery.new(:name => '_', :project => project)
|
|
3060 |
query.add_filter('author_group', '!', [not_author_group.id.to_s])
|
|
3061 |
assert_equal 3, query.issues.count
|
|
3062 |
assert_query_result issues, query
|
|
3063 |
end
|
|
3064 |
|
|
3065 |
def test_author_role_filter_should_return_issues_with_or_without_author_in_role
|
|
3066 |
project = Project.generate!
|
|
3067 |
author = User.generate!
|
|
3068 |
manager_role = Role.find_by_name('Manager')
|
|
3069 |
developer_role = Role.find_by_name('Developer')
|
|
3070 |
User.add_to_project(author, project, manager_role)
|
|
3071 |
issues = 3.times.collect { Issue.generate!(:project => project, :author => author) }
|
|
3072 |
|
|
3073 |
query = IssueQuery.new(:name => 'issues generated by manager', :project => project)
|
|
3074 |
query.add_filter('author_role', '=', [manager_role.id.to_s])
|
|
3075 |
assert_equal 3, query.issues.count
|
|
3076 |
assert_query_result issues, query
|
|
3077 |
|
|
3078 |
query = IssueQuery.new(:name => 'issues does not generated by developer', :project => project)
|
|
3079 |
query.add_filter('author_role', '!', [developer_role.id.to_s])
|
|
3080 |
assert_equal 3, query.issues.count
|
|
3081 |
assert_query_result issues, query
|
|
3082 |
end
|
|
3083 |
|
3024 |
3084 |
def test_query_column_should_accept_a_symbol_as_caption
|
3025 |
3085 |
set_language_if_valid 'en'
|
3026 |
3086 |
c = QueryColumn.new('foo', :caption => :general_text_Yes)
|