[ARVADOS] updated: 06f2f3f3143f2ba4f1bf946373e8bd273d96e82b

Git user git at public.curoverse.com
Tue May 16 12:15:54 EDT 2017


Summary of changes:
 .../views/container_requests/_show_recent.html.erb | 12 +++----
 .../container_requests/_show_recent_rows.html.erb  | 10 ++----
 .../test/integration/container_requests_test.rb    | 37 ++++++++++++++++++++++
 3 files changed, 46 insertions(+), 13 deletions(-)

       via  06f2f3f3143f2ba4f1bf946373e8bd273d96e82b (commit)
      from  a4218e78015f802b179dd9bf804478972a4e6c2e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 06f2f3f3143f2ba4f1bf946373e8bd273d96e82b
Author: radhika <radhika at curoverse.com>
Date:   Tue May 16 12:15:20 2017 -0400

    11580: test the /container_requests page

diff --git a/apps/workbench/app/views/container_requests/_show_recent.html.erb b/apps/workbench/app/views/container_requests/_show_recent.html.erb
index 4ac50fc..546b076 100644
--- a/apps/workbench/app/views/container_requests/_show_recent.html.erb
+++ b/apps/workbench/app/views/container_requests/_show_recent.html.erb
@@ -13,17 +13,17 @@
   <thead>
     <tr class="contain-align-left">
       <th>
-      	Status
+        Status
       </th><th>
-      	ContainerRequest
+        ContainerRequest
       </th><th>
-      	Description
+        Description
       </th><th>
-      	Workflow
+        Workflow
       </th><th>
-      	Owner
+        Owner
       </th><th>
-      	Created at
+        Created at
       </th><th>
       </th>
     </tr>
diff --git a/apps/workbench/app/views/container_requests/_show_recent_rows.html.erb b/apps/workbench/app/views/container_requests/_show_recent_rows.html.erb
index 0629006..25a6933 100644
--- a/apps/workbench/app/views/container_requests/_show_recent_rows.html.erb
+++ b/apps/workbench/app/views/container_requests/_show_recent_rows.html.erb
@@ -14,13 +14,9 @@
 %>
 
 <% @objects.sort_by { |obj| obj.created_at }.reverse.each do |obj| %>
-  <%
-    cntr = object_for_dataclass(Container, obj.container_uuid) if obj.container_uuid
-    wu = obj.work_unit(obj.name, cntr=cntr)
-    template_uuid = wu.template_uuid
-  %>
+  <% wu = obj.work_unit obj.name %>
 
-  <tr data-object-uuid="<%= wu.uuid %>" >
+  <tr data-object-uuid="<%= wu.uuid %>" class="cr-<%= wu.uuid %>">
     <td>
       <%= render partial: 'work_units/progress', locals: {wu: wu} %>
     </td><td>
@@ -28,7 +24,7 @@
     </td><td>
       <%= obj.description || '' %>
     </td><td>
-      <%= link_to_if_arvados_object(template_uuid, friendly_name: true) %>
+      <%= link_to_if_arvados_object wu.template_uuid, friendly_name: true %>
     </td><td>
       <%= link_to_if_arvados_object wu.owner_uuid, friendly_name: true %>
     </td><td>
diff --git a/apps/workbench/test/integration/container_requests_test.rb b/apps/workbench/test/integration/container_requests_test.rb
index 46f7e17..a053f07 100644
--- a/apps/workbench/test/integration/container_requests_test.rb
+++ b/apps/workbench/test/integration/container_requests_test.rb
@@ -121,4 +121,41 @@ class ContainerRequestsTest < ActionDispatch::IntegrationTest
     page.assert_selector 'ellipse+text', text: cr['name'], visible: false
     page.assert_selector 'g.node>title', text: cr['uuid'], visible: false
   end
+
+  [
+    'active',
+    'admin',
+  ].each do |token|
+    test "index page as #{token} user" do
+      visit page_with_token(token, "/container_requests")
+
+      running_owner_active = api_fixture("container_requests", "requester_for_running")
+      anon_accessible_cr = api_fixture("container_requests", "running_anonymous_accessible")
+
+      # both of these CRs should be accessible to the user
+      assert_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
+      assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
+
+      # both the active user (owner) and admin can delete the "running" CR
+      within(".cr-#{running_owner_active['uuid']}") do
+        assert_not_nil first('.glyphicon-trash')
+      end
+
+      # only admin user can delete the anonymously accessible CR
+      within(".cr-#{anon_accessible_cr['uuid']}") do
+        if token == 'admin'
+          assert_not_nil first('.glyphicon-trash')
+        else
+          assert_nil first('.glyphicon-trash')
+        end
+      end
+
+      # verify the search box in the page
+      find('.recent-container-requests-filterable-control').set("anonymous")
+      sleep 0.350 # Wait for 250ms debounce timer (see filterable.js)
+      wait_for_ajax
+      assert_no_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
+      assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
+    end
+  end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list