1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class GroupTest < ActiveSupport::TestCase
8 test "get contents with names" do
11 find(api_fixture('groups')['asubproject']['uuid']).
13 assert_operator(0, :<, oi.count,
14 "Expected to find some items belonging to :active user")
15 assert_operator(0, :<, oi.items_available,
16 "Expected contents response to have items_available > 0")
17 oi_uuids = oi.collect { |i| i['uuid'] }
19 expect_uuid = api_fixture('specimens')['in_asubproject']['uuid']
20 assert_includes(oi_uuids, expect_uuid,
21 "Expected '#{expect_uuid}' in asubproject's contents")
24 test "can select specific group columns" do
26 Group.select(["uuid", "name"]).limit(5).each do |user|
27 assert_not_nil user.uuid
28 assert_not_nil user.name
29 assert_nil user.owner_uuid
33 test "project editable by its admin" do
34 use_token :subproject_admin
35 project = Group.find(api_fixture("groups")["asubproject"]["uuid"])
36 assert(project.editable?, "project not editable by admin")
39 test "project not editable by reader" do
40 use_token :project_viewer
41 project = Group.find(api_fixture("groups")["aproject"]["uuid"])
42 refute(project.editable?, "project editable by reader")