3686: when a repository is manageable by a user, make repository name a link in manag...
[arvados.git] / apps / workbench / test / integration / repositories_test.rb
index 1e1a118a7a5ec6d8e9610c3d244ddd9a7bafd0dd..4c62eea55a879d3f8b76019dba86cdbdd5f5f779 100644 (file)
@@ -15,7 +15,8 @@ class RepositoriesTest < ActionDispatch::IntegrationTest
     test "#{user} can manage sharing for another user" do
       add_user = api_fixture('users')['future_project_user']
       new_name = ["first_name", "last_name"].map { |k| add_user[k] }.join(" ")
-      show_object_using(user, 'repositories', 'foo', 'push_url')
+      show_object_using(user, 'repositories', 'foo',
+                        api_fixture('repositories')['foo']['name'])
       click_on "Sharing"
       add_share_and_check("users", new_name, add_user)
       modify_share_and_check(new_name)
@@ -28,7 +29,8 @@ class RepositoriesTest < ActionDispatch::IntegrationTest
   ].each do |user|
     test "#{user} can manage sharing for another group" do
       new_name = api_fixture('groups')['future_project_viewing_group']['name']
-      show_object_using(user, 'repositories', 'foo', 'push_url')
+      show_object_using(user, 'repositories', 'foo',
+                        api_fixture('repositories')['foo']['name'])
       click_on "Sharing"
       add_share_and_check("groups", new_name)
       modify_share_and_check(new_name)
@@ -36,8 +38,27 @@ class RepositoriesTest < ActionDispatch::IntegrationTest
   end
 
   test "spectator does not see repository sharing tab" do
-    show_object_using("spectator", 'repositories', 'arvados', 'push_url')
+    show_object_using('spectator', 'repositories', 'arvados',
+                      api_fixture('repositories')['arvados']['name'])
     assert(page.has_no_link?("Sharing"),
            "read-only repository user sees sharing tab")
   end
+
+  [
+    'active',
+    'admin',
+  ].each do |user_key|
+    test "#{user_key} user is presented with attributes tab" do
+      user = api_fixture('users')[user_key]
+      show_object_using(user_key, 'repositories', 'foo',
+                        api_fixture('repositories')['foo']['name'])
+      if user['is_admin']
+        assert_selector 'li', text: 'Attributes'
+      else
+        assert_no_selector 'li', text: 'Attributes'
+      end
+      assert_selector 'li', text: 'Advanced'
+    end
+  end
+
 end