17010: Fix tests
authorPeter Amstutz <peter.amstutz@curii.com>
Wed, 21 Oct 2020 21:19:05 +0000 (17:19 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 23 Oct 2020 01:02:16 +0000 (21:02 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

apps/workbench/app/controllers/container_requests_controller.rb
apps/workbench/test/controllers/container_requests_controller_test.rb

index c42e93375bb5aeaf5b64a3f02a515609074c5301..c217eb977a2350def6c5a6ab9550d89d6b79b37a 100644 (file)
@@ -152,7 +152,7 @@ class ContainerRequestsController < ApplicationController
     @object = ContainerRequest.new
 
     # set owner_uuid to that of source, provided it is a project and writable by current user
-    if params[:work_unit][:owner_uuid]
+    if params[:work_unit].andand[:owner_uuid]
       @object.owner_uuid = src.owner_uuid = params[:work_unit][:owner_uuid]
     else
       current_project = Group.find(src.owner_uuid) rescue nil
@@ -161,7 +161,8 @@ class ContainerRequestsController < ApplicationController
       end
     end
 
-    if src.command[0] == 'arvados-cwl-runner'
+    command = src.command
+    if command[0] == 'arvados-cwl-runner'
       command.each_with_index do |arg, i|
         if arg.start_with? "--project-uuid="
           command[i] = "--project-uuid=#{@object.owner_uuid}"
@@ -174,11 +175,10 @@ class ContainerRequestsController < ApplicationController
 
     # By default the copied CR won't be reusing containers, unless use_existing=true
     # param is passed.
-    command = src.command
     if params[:use_existing]
       @object.use_existing = true
       # Pass the correct argument to arvados-cwl-runner command.
-      if src.command[0] == 'arvados-cwl-runner'
+      if command[0] == 'arvados-cwl-runner'
         command = src.command - ['--disable-reuse']
         command.insert(1, '--enable-reuse')
       end
index 140b59fa5e7d0d2c923d974a3537ff501e0647af..c4a723930da433c0240423ef1f416a2b96720524 100644 (file)
@@ -42,7 +42,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
     get :show, params: {id: uuid}, session: session_for(:active)
     assert_response :success
 
-    assert_includes @response.body, "action=\"/container_requests/#{uuid}/copy\""
+    assert_includes @response.body, "action_href=%2Fcontainer_requests%2F#{uuid}%2Fcopy"
   end
 
   test "cancel request for queued container" do