19880: Fix tests
[arvados.git] / apps / workbench / test / controllers / projects_controller_test.rb
index 0b04f80d7c411fdddf9012a16059beb039d9cc64..2d379f86400c298d369f95663ac301ec7fa5c583 100644 (file)
@@ -143,32 +143,6 @@ class ProjectsControllerTest < ActionController::TestCase
     assert_equal api_fixture('users', 'subproject_admin')['uuid'], new_specimen.owner_uuid
   end
 
     assert_equal api_fixture('users', 'subproject_admin')['uuid'], new_specimen.owner_uuid
   end
 
-  # An object which does not offer an expired_at field but has a xx_owner_uuid_name_unique constraint
-  # will be renamed when removed and another object with the same name exists in user's home project.
-  [
-    ['pipeline_templates', 'template_in_asubproject_with_same_name_as_one_in_active_user_home'],
-  ].each do |dm, fixture|
-    test "removing #{dm} from a subproject results in renaming it when there is another such object with same name in home project" do
-      object = api_fixture(dm, fixture)
-      delete(:remove_item,
-             params: { id: api_fixture('groups', 'asubproject')['uuid'],
-               item_uuid: object['uuid'],
-               format: 'js' },
-             session: session_for(:active))
-      assert_response :success
-      assert_match(/\b#{object['uuid']}\b/, @response.body,
-                   "removed object not named in response")
-      use_token :active
-      if dm.eql?('groups')
-        found = Group.find(object['uuid'])
-      else
-        found = PipelineTemplate.find(object['uuid'])
-      end
-      assert_equal api_fixture('users', 'active')['uuid'], found.owner_uuid
-      assert_equal true, found.name.include?(object['name'] + ' removed from ')
-    end
-  end
-
   test 'projects#show tab infinite scroll partial obeys limit' do
     get_contents_rows(limit: 1, filters: [['uuid','is_a',['arvados#job']]])
     assert_response :success
   test 'projects#show tab infinite scroll partial obeys limit' do
     get_contents_rows(limit: 1, filters: [['uuid','is_a',['arvados#job']]])
     assert_response :success
@@ -177,7 +151,7 @@ class ProjectsControllerTest < ActionController::TestCase
   end
 
   ['', ' asc', ' desc'].each do |direction|
   end
 
   ['', ' asc', ' desc'].each do |direction|
-    test "projects#show tab partial orders correctly by #{direction}" do
+    test "projects#show tab partial orders correctly by created_at#{direction}" do
       _test_tab_content_order direction
     end
   end
       _test_tab_content_order direction
     end
   end
@@ -290,7 +264,7 @@ class ProjectsControllerTest < ActionController::TestCase
   end
 
   test "visit public projects page when anon config is not enabled as anonymous and expect login page" do
   end
 
   test "visit public projects page when anon config is not enabled as anonymous and expect login page" do
-    Rails.configuration.Users.AnonymousUserToken = nil
+    Rails.configuration.Users.AnonymousUserToken = ""
     Rails.configuration.Workbench.EnablePublicProjectsPage = false
     get :public
     assert_response :redirect
     Rails.configuration.Workbench.EnablePublicProjectsPage = false
     get :public
     assert_response :redirect
@@ -422,10 +396,7 @@ EOT
     end
   end
 
     end
   end
 
-  [
-    [:admin, true],
-    [:active, false],
-  ].each do |user, expect_all_nodes|
+  [:admin, :active].each do |user|
     test "in dashboard other index page links as #{user}" do
       get :index, params: {}, session: session_for(user)
 
     test "in dashboard other index page links as #{user}" do
       get :index, params: {}, session: session_for(user)
 
@@ -435,14 +406,6 @@ EOT
         assert_includes @response.body, "href=\"#{path}\""
         assert_includes @response.body, "All #{target}"
       end
         assert_includes @response.body, "href=\"#{path}\""
         assert_includes @response.body, "All #{target}"
       end
-
-      if expect_all_nodes
-        assert_includes @response.body, "href=\"/nodes\""
-        assert_includes @response.body, "All nodes"
-      else
-        assert_not_includes @response.body, "href=\"/nodes\""
-        assert_not_includes @response.body, "All nodes"
-      end
     end
   end
 
     end
   end
 
@@ -560,12 +523,12 @@ EOT
       use_token user
       ctrl = ProjectsController.new
       current_user = User.find(api_fixture('users')[user]['uuid'])
       use_token user
       ctrl = ProjectsController.new
       current_user = User.find(api_fixture('users')[user]['uuid'])
-      my_starred_project = ctrl.send :my_starred_projects, current_user
+      my_starred_project = ctrl.send :my_starred_projects, current_user, ''
       assert_equal(size, my_starred_project.andand.size)
 
       ctrl2 = ProjectsController.new
       current_user = User.find(api_fixture('users')[user]['uuid'])
       assert_equal(size, my_starred_project.andand.size)
 
       ctrl2 = ProjectsController.new
       current_user = User.find(api_fixture('users')[user]['uuid'])
-      my_starred_project = ctrl2.send :my_starred_projects, current_user
+      my_starred_project = ctrl2.send :my_starred_projects, current_user, ''
       assert_equal(size, my_starred_project.andand.size)
     end
   end
       assert_equal(size, my_starred_project.andand.size)
     end
   end
@@ -579,7 +542,7 @@ EOT
     use_token :project_viewer
     current_user = User.find(api_fixture('users')['project_viewer']['uuid'])
     ctrl = ProjectsController.new
     use_token :project_viewer
     current_user = User.find(api_fixture('users')['project_viewer']['uuid'])
     ctrl = ProjectsController.new
-    my_starred_project = ctrl.send :my_starred_projects, current_user
+    my_starred_project = ctrl.send :my_starred_projects, current_user, ''
     assert_equal(0, my_starred_project.andand.size)
 
     # share it again
     assert_equal(0, my_starred_project.andand.size)
 
     # share it again
@@ -597,7 +560,7 @@ EOT
     # verify that the project is again included in starred projects
     use_token :project_viewer
     ctrl = ProjectsController.new
     # verify that the project is again included in starred projects
     use_token :project_viewer
     ctrl = ProjectsController.new
-    my_starred_project = ctrl.send :my_starred_projects, current_user
+    my_starred_project = ctrl.send :my_starred_projects, current_user, ''
     assert_equal(1, my_starred_project.andand.size)
   end
 end
     assert_equal(1, my_starred_project.andand.size)
   end
 end