Improve API server's git rev-list calls.
[arvados.git] / apps / workbench / test / unit / group_test.rb
1 require 'test_helper'
2
3 class GroupTest < ActiveSupport::TestCase
4   test "get contents with names" do
5     use_token :active
6     oi = Group.
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'] }
16
17     expect_uuid = api_fixture('specimens')['in_asubproject']['uuid']
18     assert_includes(oi_uuids, expect_uuid,
19                     "Expected '#{expect_uuid}' in asubproject's contents")
20
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}'")
27   end
28 end