2 require 'helpers/share_object_helper'
4 class RepositoriesControllerTest < ActionController::TestCase
5 include ShareObjectHelper
11 test "#{user} shares repository with a user and group" do
12 uuid_list = [api_fixture("groups")["future_project_viewing_group"]["uuid"],
13 api_fixture("users")["future_project_user"]["uuid"]]
15 id: api_fixture("repositories")["foo"]["uuid"],
19 assert_response :success
20 assert_equal(uuid_list, json_response["success"])
24 test "user with repository read permission cannot add permissions" do
25 share_uuid = api_fixture("users")["project_viewer"]["uuid"]
27 id: api_fixture("repositories")["arvados"]["uuid"],
30 session_for(:spectator))
32 assert(json_response["errors"].andand.
33 any? { |msg| msg.start_with?("#{share_uuid}: ") },
34 "JSON response missing properly formatted sharing error")
37 test "admin can_manage repository" do
38 assert user_can_manage(:admin, api_fixture("repositories")["foo"])
41 test "owner can_manage repository" do
42 assert user_can_manage(:active, api_fixture("repositories")["foo"])
45 test "viewer cannot manage repository" do
46 refute user_can_manage(:spectator, api_fixture("repositories")["arvados"])
50 [:active, ['#Sharing', '#Advanced']],
51 [:admin, ['#Attributes', '#Sharing', '#Advanced']],
52 ].each do |user, expected_panes|
53 test "#{user} sees panes #{expected_panes}" do
55 id: api_fixture('repositories')['foo']['uuid']
57 assert_response :success
59 panes = css_select('[data-toggle=tab]').each do |pane|
60 pane_name = pane.attributes['href']
61 assert_includes expected_panes, pane_name