[ARVADOS] created: cd584f6095b0c543a16b77b2041de887d99492d8

Git user git at public.curoverse.com
Thu Jun 8 13:16:21 EDT 2017


        at  cd584f6095b0c543a16b77b2041de887d99492d8 (commit)


commit cd584f6095b0c543a16b77b2041de887d99492d8
Author: radhika <radhika at curoverse.com>
Date:   Thu Jun 8 13:15:52 2017 -0400

    11837: write tests

diff --git a/apps/workbench/test/controllers/trash_items_controller_test.rb b/apps/workbench/test/controllers/trash_items_controller_test.rb
new file mode 100644
index 0000000..d5b0d90
--- /dev/null
+++ b/apps/workbench/test/controllers/trash_items_controller_test.rb
@@ -0,0 +1,28 @@
+require 'test_helper'
+
+class TrashItemsControllerTest < ActionController::TestCase
+  reset_api_fixtures :after_each_test, false
+  reset_api_fixtures :after_suite, true
+
+  [
+    :active,
+    :admin,
+  ].each do |user|
+    test "trash index page as #{user}" do
+      get :index, {partial: :trash_rows, format: :json}, session_for(user)
+      assert_response :success
+
+      items = []
+      @response.body.scan(/tr\ data-object-uuid=\\"(.*?)\\"/).each do |uuid,|
+        items << uuid
+      end
+
+      assert_includes(items, api_fixture('collections')['unique_expired_collection']['uuid'])
+      if user == :admin
+        assert_includes(items, api_fixture('collections')['unique_expired_collection2']['uuid'])
+      else
+        assert_not_includes(items, api_fixture('collections')['unique_expired_collection2']['uuid'])
+      end
+    end
+  end
+end
diff --git a/apps/workbench/test/integration/trash_test.rb b/apps/workbench/test/integration/trash_test.rb
index cd2fa39..857e57a 100644
--- a/apps/workbench/test/integration/trash_test.rb
+++ b/apps/workbench/test/integration/trash_test.rb
@@ -15,8 +15,8 @@ class TrashTest < ActionDispatch::IntegrationTest
 
     assert_text deleted['name']
     assert_text expired1['name']
-    assert_text expired2['name']
-    assert_no_text 'foo_file'
+    assert_no_text expired2['name']   # not readable by this user
+    assert_no_text 'foo_file'         # not trash
 
     # Un-trash one item using selection dropdown
     within('tr', text: deleted['name']) do
@@ -33,12 +33,6 @@ class TrashTest < ActionDispatch::IntegrationTest
     assert_text expired1['name']      # this should still be there
     assert_no_text deleted['name']    # this should no longer be here
 
-    # expired2 is not editable by me; checkbox and recycle button shouldn't be offered
-    within('tr', text: expired2['name']) do
-      assert_nil first('input')
-      assert_nil first('.fa-recycle')
-    end
-
     # Un-trash another item using the recycle button
     within('tr', text: expired1['name']) do
       first('.fa-recycle').click
@@ -46,7 +40,6 @@ class TrashTest < ActionDispatch::IntegrationTest
 
     wait_for_ajax
 
-    assert_text expired2['name']
     assert_no_text expired1['name']
 
     # verify that the two un-trashed items are now shown in /collections page
@@ -58,7 +51,7 @@ class TrashTest < ActionDispatch::IntegrationTest
 
   test "trash page with search" do
     deleted = api_fixture('collections')['deleted_on_next_sweep']
-    expired = api_fixture('collections')['unique_expired_collection2']
+    expired = api_fixture('collections')['unique_expired_collection']
 
     visit page_with_token('active', "/trash")
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list