3 class GroupTest < ActiveSupport::TestCase
4 test "get contents with names" do
7 find(api_fixture('groups')['asubproject']['uuid']).
9 assert_operator(0, :<, oi.count,
10 "Expected to find some items belonging to :active user")
11 assert_operator(0, :<, oi.items_available,
12 "Expected contents response to have items_available > 0")
13 oi_uuids = oi.collect { |i| i['uuid'] }
15 expect_uuid = api_fixture('specimens')['in_asubproject']['uuid']
16 assert_includes(oi_uuids, expect_uuid,
17 "Expected '#{expect_uuid}' in asubproject's contents")
20 test "can select specific group columns" do
22 Group.select(["uuid", "name"]).limit(5).each do |user|
23 assert_not_nil user.uuid
24 assert_not_nil user.name
25 assert_nil user.owner_uuid
29 test "project editable by its admin" do
30 use_token :subproject_admin
31 project = Group.find(api_fixture("groups")["asubproject"]["uuid"])
32 assert(project.editable?, "project not editable by admin")
35 test "project not editable by reader" do
36 use_token :project_viewer
37 project = Group.find(api_fixture("groups")["aproject"]["uuid"])
38 refute(project.editable?, "project editable by reader")