13111: Merge branch 'master' into 12308-go-fuse
[arvados.git] / apps / workbench / test / controllers / container_requests_controller_test.rb
index bd2f6beb6b45a6270825ba16eb34b2a0b00120ad..261169cd1f954c352aaba6e58e577c9d0a955b4d 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require 'test_helper'
 
 class ContainerRequestsControllerTest < ActionController::TestCase
@@ -38,7 +42,21 @@ class ContainerRequestsControllerTest < ActionController::TestCase
     get :show, {id: uuid}, session_for(:active)
     assert_response :success
 
-   assert_includes @response.body, "action=\"/container_requests/#{uuid}/copy\""
+    assert_includes @response.body, "action=\"/container_requests/#{uuid}/copy\""
+  end
+
+  test "cancel request for queued container" do
+    cr_fixture = api_fixture('container_requests')['queued']
+    post :cancel, {id: cr_fixture['uuid']}, session_for(:active)
+    assert_response 302
+
+    use_token 'active'
+    cr = ContainerRequest.find(cr_fixture['uuid'])
+    assert_equal 'Final', cr.state
+    assert_equal 0, cr.priority
+    c = Container.find(cr_fixture['container_uuid'])
+    assert_equal 'Queued', c.state
+    assert_equal 0, c.priority
   end
 
   [
@@ -106,4 +124,20 @@ class ContainerRequestsControllerTest < ActionController::TestCase
       end
     end
   end
+
+  test "container request display" do
+    use_token 'active'
+
+    cr = api_fixture('container_requests')['completed_with_input_mounts']
+
+    get :show, {id: cr['uuid']}, session_for(:active)
+    assert_response :success
+
+    assert_match /hello/, @response.body
+    assert_includes @response.body, "href=\"\/collections/fa7aeb5140e2848d39b416daeef4ffc5+45/foo" # mount input1
+    assert_includes @response.body, "href=\"\/collections/fa7aeb5140e2848d39b416daeef4ffc5+45/bar" # mount input2
+    assert_includes @response.body, "href=\"\/collections/1fd08fc162a5c6413070a8bd0bffc818+150" # mount workflow
+    assert_includes @response.body, "href=\"#Log\""
+    assert_includes @response.body, "href=\"#Provenance\""
+  end
 end