Merge branch 'master' into 2767-doc-updates
[arvados.git] / services / api / test / integration / permissions_test.rb
index 9a190aab952f3a6b164f9d9d4ec6ef378b13a895..2ebd62bc8b9b3a743dba496abce3bf59830e5a53 100644 (file)
@@ -3,10 +3,6 @@ require 'test_helper'
 class PermissionsTest < ActionDispatch::IntegrationTest
   fixtures :users, :groups, :api_client_authorizations, :collections
 
-  def auth auth_fixture
-    {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(auth_fixture).api_token}"}
-  end
-
   test "adding and removing direct can_read links" do
     # try to read collection as spectator
     get "/arvados/v1/collections/#{collections(:foo_file).uuid}", {:format => :json}, auth(:spectator)
@@ -36,7 +32,7 @@ class PermissionsTest < ActionDispatch::IntegrationTest
         properties: {}
       }
     }, auth(:admin)
-    u = jresponse['uuid']
+    u = json_response['uuid']
     assert_response :success
 
     # read collection as spectator
@@ -90,7 +86,7 @@ class PermissionsTest < ActionDispatch::IntegrationTest
         properties: {}
       }
     }, auth(:admin)
-    u = jresponse['uuid']
+    u = json_response['uuid']
     assert_response :success
 
     # try to read collection as spectator
@@ -141,7 +137,7 @@ class PermissionsTest < ActionDispatch::IntegrationTest
         properties: {}
       }
     }, auth(:admin)
-    u = jresponse['uuid']
+    u = json_response['uuid']
     assert_response :success
 
     # try to read collection as spectator
@@ -200,7 +196,7 @@ class PermissionsTest < ActionDispatch::IntegrationTest
         properties: {}
       }
     }, auth(:admin)
-    u = jresponse['uuid']
+    u = json_response['uuid']
     assert_response :success
 
     # try to read collection as spectator
@@ -219,7 +215,7 @@ class PermissionsTest < ActionDispatch::IntegrationTest
   test "read-only group-admin sees correct subset of user list" do
     get "/arvados/v1/users", {:format => :json}, auth(:rominiadmin)
     assert_response :success
-    resp_uuids = jresponse['items'].collect { |i| i['uuid'] }
+    resp_uuids = json_response['items'].collect { |i| i['uuid'] }
     [[true, users(:rominiadmin).uuid],
      [true, users(:active).uuid],
      [false, users(:miniadmin).uuid],
@@ -258,7 +254,7 @@ class PermissionsTest < ActionDispatch::IntegrationTest
      [:miniadmin, true]].each do |which_user, update_should_succeed|
       get "/arvados/v1/specimens", {:format => :json}, auth(which_user)
       assert_response :success
-      resp_uuids = jresponse['items'].collect { |i| i['uuid'] }
+      resp_uuids = json_response['items'].collect { |i| i['uuid'] }
       [[true, specimens(:owned_by_active_user).uuid],
        [true, specimens(:owned_by_private_group).uuid],
        [false, specimens(:owned_by_spectator).uuid],