Merge branch '2800-pgs' refs #2800
[arvados.git] / services / api / test / functional / arvados / v1 / groups_controller_test.rb
index 5eeca0770c0cbdef9b042e641edd6feaafaedc1a..217809ae6569cf55b066cd776fd187405b5519b4 100644 (file)
@@ -16,11 +16,11 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
 
   test "get list of projects" do
     authorize_with :active
-    get :index, filters: [['group_class', 'in', ['project', 'folder']]], format: :json
+    get :index, filters: [['group_class', '=', 'project']], format: :json
     assert_response :success
     group_uuids = []
     json_response['items'].each do |group|
-      assert_includes ['folder', 'project'], group['group_class']
+      assert_equal 'project', group['group_class']
       group_uuids << group['uuid']
     end
     assert_includes group_uuids, groups(:aproject).uuid
@@ -112,6 +112,24 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     end
   end
 
+  [false, true].each do |include_linked|
+    test "list objects in home project, include_linked=#{include_linked}" do
+      authorize_with :active
+      get :contents, {
+        format: :json,
+        id: users(:active).uuid,
+        include_linked: include_linked,
+      }
+      assert_response :success
+      found_uuids = json_response['items'].collect { |i| i['uuid'] }
+      if include_linked
+        assert_includes found_uuids, collections(:empty).uuid, "empty collection did not appear in home project"
+      end
+      assert_includes found_uuids, specimens(:owned_by_active_user).uuid, "specimen did not appear in home project"
+      refute_includes found_uuids, specimens(:in_asubproject).uuid, "specimen appeared unexpectedly in home project"
+    end
+  end
+
   test "user with project read permission can see project collections" do
     authorize_with :project_viewer
     get :contents, {