3 class GroupsTest < ActionDispatch::IntegrationTest
4 [[], ['replication_confirmed']].each do |orders|
5 test "results are consistent when provided orders #{orders} is incomplete" do
8 get '/arvados/v1/groups/contents', {
9 id: groups(:aproject).uuid,
10 filters: [["uuid", "is_a", "arvados#collection"]].to_json,
11 orders: orders.to_json,
14 assert_response :success
16 last = json_response['items']
18 assert_equal last, json_response['items']
24 test "get all pages of group-owned objects" do
31 get "/arvados/v1/groups/contents", {
32 id: groups(:aproject).uuid,
38 assert_response :success
39 assert_operator(0, :<, json_response['items'].count,
40 "items_available=#{items_available} but received 0 "\
41 "items with offset=#{offset}")
42 items_available ||= json_response['items_available']
43 assert_equal(items_available, json_response['items_available'],
44 "items_available changed between page #{offset/limit} "\
45 "and page #{1+offset/limit}")
46 json_response['items'].each do |item|
48 assert_equal(nil, uuid_received[uuid],
49 "Received '#{uuid}' again on page #{1+offset/limit}")
50 uuid_received[uuid] = true
51 owner_received[item['owner_uuid']] = true
53 assert_equal groups(:aproject).uuid, item['owner_uuid']
55 break if offset >= items_available
60 ['Collection_', true], # collections and pipelines templates
61 ['hash', true], # pipeline templates
62 ['fa7aeb5140e2848d39b', false], # script_parameter of pipeline instances
63 ['fa7aeb5140e2848d39b:*', true], # script_parameter of pipeline instances
64 ['project pipeline', true], # finds "Completed pipeline in A Project"
65 ['project pipeli:*', true], # finds "Completed pipeline in A Project"
66 ['proje pipeli:*', false], # first word is incomplete, so no prefix match
67 ['no-such-thing', false], # script_parameter of pipeline instances
68 ].each do |search_filter, expect_results|
69 test "full text search of group-owned objects for #{search_filter}" do
70 get "/arvados/v1/groups/contents", {
71 id: groups(:aproject).uuid,
73 :filters => [['any', '@@', search_filter]].to_json
75 assert_response :success
77 refute_empty json_response['items']
78 json_response['items'].each do |item|
80 assert_equal groups(:aproject).uuid, item['owner_uuid']
83 assert_empty json_response['items']
88 test "full text search is not supported for individual columns" do
89 get "/arvados/v1/groups/contents", {
90 :filters => [['name', '@@', 'Private']].to_json