3 class LinkTest < ActiveSupport::TestCase
5 reset_api_fixtures :after_each_test, false
7 def uuid_for(fixture_name, object_name)
8 api_fixture(fixture_name)[object_name]["uuid"]
11 test "active user can get permissions for owned project object" do
13 project = Group.find(uuid_for("groups", "aproject"))
14 refute_empty(Link.permissions_for(project),
15 "no permissions found for managed project")
18 test "active user can get permissions for owned project by UUID" do
20 refute_empty(Link.permissions_for(uuid_for("groups", "aproject")),
21 "no permissions found for managed project")
24 test "admin can get permissions for project object" do
26 project = Group.find(uuid_for("groups", "aproject"))
27 refute_empty(Link.permissions_for(project),
28 "no permissions found for managed project")
31 test "admin can get permissions for project by UUID" do
33 refute_empty(Link.permissions_for(uuid_for("groups", "aproject")),
34 "no permissions found for managed project")
37 test "project viewer can't get permissions for readable project object" do
38 use_token :project_viewer
39 project = Group.find(uuid_for("groups", "aproject"))
40 assert_raises(ArvadosApiClient::AccessForbiddenException) do
41 Link.permissions_for(project)
45 test "project viewer can't get permissions for readable project by UUID" do
46 use_token :project_viewer
47 assert_raises(ArvadosApiClient::AccessForbiddenException) do
48 Link.permissions_for(uuid_for("groups", "aproject"))