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