Merge branch '1968-monitor-disk-usage'
[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')['asubfolder']['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_asubfolder']['uuid']
18     assert_includes(oi_uuids, expect_uuid,
19                     "Expected '#{expect_uuid}' in asubfolder's contents")
20
21     expect_uuid = api_fixture('specimens')['in_afolder_linked_from_asubfolder']['uuid']
22     expect_name = api_fixture('links')['specimen_is_in_two_folders']['name']
23     assert_includes(oi_uuids, expect_uuid,
24                     "Expected '#{expect_uuid}' in asubfolder'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