- [
- ['Collection_', true], # collections and pipelines templates
- ['hash', true], # pipeline templates
- ['fa7aeb5140e2848d39b', false], # script_parameter of pipeline instances
- ['fa7aeb5140e2848d39b:*', true], # script_parameter of pipeline instances
- ['project pipeline', true], # finds "Completed pipeline in A Project"
- ['project pipeli:*', true], # finds "Completed pipeline in A Project"
- ['proje pipeli:*', false], # first word is incomplete, so no prefix match
- ['no-such-thing', false], # script_parameter of pipeline instances
- ].each do |search_filter, expect_results|
- test "full text search of group-owned objects for #{search_filter}" do
- get "/arvados/v1/groups/contents", {
+ test "group contents with include trash collections" do
+ get "/arvados/v1/groups/contents",
+ params: {
+ include_trash: "true",
+ filters: [["uuid", "is_a", "arvados#collection"]].to_json,
+ limit: 1000
+ },
+ headers: auth(:active)
+ assert_response 200
+
+ coll_uuids = []
+ json_response['items'].each { |c| coll_uuids << c['uuid'] }
+ assert_includes coll_uuids, collections(:foo_collection_in_aproject).uuid
+ assert_includes coll_uuids, collections(:expired_collection).uuid
+ end
+
+ test "group contents without trash collections" do
+ get "/arvados/v1/groups/contents",
+ params: {
+ filters: [["uuid", "is_a", "arvados#collection"]].to_json,
+ limit: 1000
+ },
+ headers: auth(:active)
+ assert_response 200
+
+ coll_uuids = []
+ json_response['items'].each { |c| coll_uuids << c['uuid'] }
+ assert_includes coll_uuids, collections(:foo_collection_in_aproject).uuid
+ assert_not_includes coll_uuids, collections(:expired_collection).uuid
+ end
+
+ test "unsharing a project results in hiding it from previously shared user" do
+ # remove sharing link for project
+ delete "/arvados/v1/links/#{links(:share_starred_project_with_project_viewer).uuid}", headers: auth(:admin)
+ assert_response 200
+
+ # verify that the user can no longer see the project
+ get "/arvados/v1/groups",
+ params: {
+ filters: [['group_class', '=', 'project']].to_json,
+ limit: 1000
+ }, headers: auth(:project_viewer)
+ assert_response 200
+ found_projects = {}
+ json_response['items'].each do |g|
+ found_projects[g['uuid']] = g
+ end
+ assert_equal false, found_projects.include?(groups(:starred_and_shared_active_user_project).uuid)
+
+ # share the project
+ post "/arvados/v1/links", params: {
+ link: {
+ link_class: "permission",
+ name: "can_read",
+ head_uuid: groups(:starred_and_shared_active_user_project).uuid,
+ tail_uuid: users(:project_viewer).uuid,
+ }
+ }, headers: auth(:system_user)
+ assert_response 200
+ assert_equal 'permission', json_response['link_class']
+
+ # verify that project_viewer user can now see shared project again
+ get "/arvados/v1/groups", params: {
+ filters: [['group_class', '=', 'project']].to_json,
+ limit: 1000
+ }, headers: auth(:project_viewer)
+ assert_response 200
+ found_projects = {}
+ json_response['items'].each do |g|
+ found_projects[g['uuid']] = g
+ end
+ assert_equal true, found_projects.include?(groups(:starred_and_shared_active_user_project).uuid)
+ end
+
+ test 'count none works with offset' do
+ first_results = nil
+ (0..10).each do |offset|
+ get "/arvados/v1/groups/contents", params: {