14287: Merge branch 'master'
[arvados.git] / services / api / test / functional / arvados / v1 / container_requests_controller_test.rb
index 282e09049e63beab2e591ac71f38b47e9484261d..e77e2ed3c6bdc11ac7f6fcd3ad54c5869ece2c46 100644 (file)
@@ -17,7 +17,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
     authorize_with :active
 
     sp = {'partitions' => ['test1', 'test2']}
-    post :create, {
+    post :create, params: {
            container_request: minimal_cr.merge(scheduling_parameters: sp.dup)
          }
     assert_response :success
@@ -30,7 +30,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
   test "secret_mounts not in #create responses" do
     authorize_with :active
 
-    post :create, {
+    post :create, params: {
            container_request: minimal_cr.merge(
              secret_mounts: {'/foo' => {'kind' => 'json', 'content' => 'bar'}}),
          }
@@ -47,7 +47,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
     authorize_with :active
     req = container_requests(:uncommitted)
 
-    patch :update, {
+    patch :update, params: {
             id: req.uuid,
             container_request: {
               secret_mounts: {'/foo' => {'kind' => 'json', 'content' => 'bar'}},
@@ -67,7 +67,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
     req = container_requests(:uncommitted)
     req.update_attributes!(secret_mounts: {'/foo' => {'kind' => 'json', 'content' => 'bar'}})
 
-    patch :update, {
+    patch :update, params: {
             id: req.uuid,
             container_request: {
               command: ['echo', 'test'],
@@ -81,4 +81,21 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
     req.reload
     assert_equal 'bar', req.secret_mounts['/foo']['content']
   end
+
+  test "runtime_token not in #create responses" do
+    authorize_with :active
+
+    post :create, params: {
+           container_request: minimal_cr.merge(
+             runtime_token: api_client_authorizations(:spectator).token)
+         }
+    assert_response :success
+
+    resp = JSON.parse(@response.body)
+    refute resp.has_key?('runtime_token')
+
+    req = ContainerRequest.where(uuid: resp['uuid']).first
+    assert_equal api_client_authorizations(:spectator).token, req.runtime_token
+  end
+
 end