3 class GroupTest < ActiveSupport::TestCase
4 test "get contents with names" do
7 find(api_fixture('groups')['asubproject']['uuid']).
8 contents(include_linked: true)
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 assert_operator(0, :<, oi.result_links.count,
14 "Expected to receive name links with contents response")
15 oi_uuids = oi.collect { |i| i['uuid'] }
17 expect_uuid = api_fixture('specimens')['in_asubproject']['uuid']
18 assert_includes(oi_uuids, expect_uuid,
19 "Expected '#{expect_uuid}' in asubproject's contents")
21 expect_uuid = api_fixture('specimens')['in_aproject_linked_from_asubproject']['uuid']
22 expect_name = api_fixture('links')['specimen_is_in_two_projects']['name']
23 assert_includes(oi_uuids, expect_uuid,
24 "Expected '#{expect_uuid}' in asubproject's contents")
25 assert_equal(expect_name, oi.name_for(expect_uuid),
26 "Expected name_for '#{expect_uuid}' to be '#{expect_name}'")
29 test "can select specific group columns" do
31 Group.select(["uuid", "name"]).limit(5).each do |user|
32 assert_not_nil user.uuid
33 assert_not_nil user.name
34 assert_nil user.owner_uuid