939 |
939 |
assert_not_include 'bookmarks', filter[:values].map{|v| v[1]}
|
940 |
940 |
end
|
941 |
941 |
|
|
942 |
def test_filter_project_parent_id_with_my_projects
|
|
943 |
User.current = User.find(1)
|
|
944 |
query = ProjectQuery.new(:name => '_')
|
|
945 |
filter = query.available_filters['parent_id']
|
|
946 |
assert_not_nil filter
|
|
947 |
assert_include 'mine', filter[:values].map{|v| v[1]}
|
|
948 |
|
|
949 |
query.filters = { 'parent_id' => {:operator => '=', :values => ['mine']}}
|
|
950 |
result = query.results_scope
|
|
951 |
|
|
952 |
my_projects = User.current.memberships.map(&:project_id)
|
|
953 |
assert_equal Project.where(parent_id: my_projects).ids, result.map(&:id).sort
|
|
954 |
end
|
|
955 |
|
|
956 |
def test_filter_project_parent_id_with_my_bookmarks
|
|
957 |
User.current = User.find(1)
|
|
958 |
query = ProjectQuery.new(:name => '_')
|
|
959 |
filter = query.available_filters['parent_id']
|
|
960 |
assert_not_nil filter
|
|
961 |
assert_include 'bookmarks', filter[:values].map{|v| v[1]}
|
|
962 |
|
|
963 |
query.filters = { 'parent_id' => {:operator => '=', :values => ['bookmarks']}}
|
|
964 |
result = query.results_scope
|
|
965 |
|
|
966 |
bookmarks = User.current.bookmarked_project_ids
|
|
967 |
assert_equal Project.where(parent_id: bookmarks).ids, result.map(&:id).sort
|
|
968 |
end
|
|
969 |
|
942 |
970 |
def test_filter_watched_issues
|
943 |
971 |
User.current = User.find(1)
|
944 |
972 |
query = IssueQuery.new(:name => '_', :filters => { 'watcher_id' => {:operator => '=', :values => ['me']}})
|