Merge branch '4878-rerun-job-bcs-wip'
[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', 'push_url')
19       click_on "Sharing"
20       add_share_and_check("users", new_name, add_user)
21       modify_share_and_check(new_name)
22     end
23   end
24
25   [
26     'active', #owner
27     'admin'
28   ].each do |user|
29     test "#{user} can manage sharing for another group" do
30       new_name = api_fixture('groups')['future_project_viewing_group']['name']
31       show_object_using(user, 'repositories', 'foo', 'push_url')
32       click_on "Sharing"
33       add_share_and_check("groups", new_name)
34       modify_share_and_check(new_name)
35     end
36   end
37
38   test "spectator does not see repository sharing tab" do
39     show_object_using("spectator", 'repositories', 'arvados', 'push_url')
40     assert(page.has_no_link?("Sharing"),
41            "read-only repository user sees sharing tab")
42   end
43 end