mirror of
https://github.com/redmine/redmine.git
synced 2026-07-07 17:53:33 +02:00
- adds 'name' filter that mimics the old behavior of matching on email, login, first- or lastname - maps the 'status' url parameter to the status_id filter, and the 'name' url parameter to the new name filter Patch by Jens Krämer. git-svn-id: https://svn.redmine.org/redmine/trunk@22343 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -108,6 +108,29 @@ class UserQueryTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_name_or_email_or_login_filter
|
||||
[
|
||||
['~', 'jsmith', [2]],
|
||||
['^', 'jsm', [2]],
|
||||
['$', 'ith', [2]],
|
||||
['~', 'john', [2]],
|
||||
['~', 'smith', [2]],
|
||||
['~', 'somenet', [1, 2, 3, 4]],
|
||||
['!~', 'somenet', [7, 8, 9]],
|
||||
['^', 'dlop', [3]],
|
||||
['$', 'bar', [7, 8, 9]],
|
||||
['=', 'bar', []],
|
||||
['=', 'someone@foo.bar', [7]],
|
||||
['*', '', [1, 2, 3, 4, 7, 8, 9]],
|
||||
['!*', '', []],
|
||||
].each do |op, string, result|
|
||||
q = UserQuery.new name: '_'
|
||||
q.add_filter('name', op, [string])
|
||||
users = find_users_with_query q
|
||||
assert_equal result, users.map(&:id).sort, "#{op} #{string} should have found #{result}"
|
||||
end
|
||||
end
|
||||
|
||||
def test_group_filter
|
||||
q = UserQuery.new name: '_'
|
||||
q.add_filter('is_member_of_group', '=', ['10', '99'])
|
||||
|
||||
Reference in New Issue
Block a user