3 class LinkTest < ActiveSupport::TestCase
4 def uuid_for(fixture_name, object_name)
5 api_fixture(fixture_name)[object_name]["uuid"]
8 test "active user can get permissions for owned project object" do
10 project = Group.find(uuid_for("groups", "aproject"))
11 refute_empty(Link.permissions_for(project),
12 "no permissions found for managed project")
15 test "active user can get permissions for owned project by UUID" do
17 refute_empty(Link.permissions_for(uuid_for("groups", "aproject")),
18 "no permissions found for managed project")
21 test "admin can get permissions for project object" do
23 project = Group.find(uuid_for("groups", "aproject"))
24 refute_empty(Link.permissions_for(project),
25 "no permissions found for managed project")
28 test "admin can get permissions for project by UUID" do
30 refute_empty(Link.permissions_for(uuid_for("groups", "aproject")),
31 "no permissions found for managed project")
34 test "project viewer can't get permissions for readable project object" do
35 use_token :project_viewer
36 project = Group.find(uuid_for("groups", "aproject"))
37 assert_raises(ArvadosApiClient::AccessForbiddenException) do
38 Link.permissions_for(project)
42 test "project viewer can't get permissions for readable project by UUID" do
43 use_token :project_viewer
44 assert_raises(ArvadosApiClient::AccessForbiddenException) do
45 Link.permissions_for(uuid_for("groups", "aproject"))