16202: Add Workbench.SSHHelpHostSuffix
[arvados.git] / apps / workbench / test / integration / repositories_test.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 require 'integration_helper'
6 require 'helpers/share_object_helper'
7
8 class RepositoriesTest < ActionDispatch::IntegrationTest
9   include ShareObjectHelper
10
11   setup do
12     need_javascript
13   end
14
15   [
16     'active', #owner
17     'admin'
18   ].each do |user|
19     test "#{user} can manage sharing for another user" do
20       add_user = api_fixture('users')['future_project_user']
21       new_name = ["first_name", "last_name"].map { |k| add_user[k] }.join(" ")
22       show_object_using(user, 'repositories', 'foo',
23                         api_fixture('repositories')['foo']['name'])
24       click_on "Sharing"
25       add_share_and_check("users", new_name, add_user)
26       modify_share_and_check(new_name)
27     end
28   end
29
30   [
31     'active', #owner
32     'admin'
33   ].each do |user|
34     test "#{user} can manage sharing for another group" do
35       new_name = api_fixture('groups')['future_project_viewing_group']['name']
36       show_object_using(user, 'repositories', 'foo',
37                         api_fixture('repositories')['foo']['name'])
38       click_on "Sharing"
39       add_share_and_check("groups", new_name)
40       modify_share_and_check(new_name)
41     end
42   end
43
44   test "spectator does not see repository sharing tab" do
45     show_object_using('spectator', 'repositories', 'arvados',
46                       api_fixture('repositories')['arvados']['name'])
47     assert(page.has_no_link?("Sharing"),
48            "read-only repository user sees sharing tab")
49   end
50 end