Merge branch '14196-api-v2-tokens' refs #14196
[arvados.git] / services / api / test / test_helper.rb
index 40e801e013ab39d047c1e027693d0a00721a2b12..ffd50d808072887884caabffab08252aa2d71716 100644 (file)
@@ -41,11 +41,11 @@ module ArvadosTestSupport
   end
 
   def api_token(api_client_auth_name)
-    api_client_authorizations(api_client_auth_name).api_token
+    api_client_authorizations(api_client_auth_name).token
   end
 
   def auth(api_client_auth_name)
-    {'HTTP_AUTHORIZATION' => "OAuth2 #{api_token(api_client_auth_name)}"}
+    {'HTTP_AUTHORIZATION' => "Bearer #{api_token(api_client_auth_name)}"}
   end
 
   def show_errors model
@@ -119,14 +119,14 @@ class ActiveSupport::TestCase
   end
 
   def authorize_with api_client_auth_name
-    authorize_with_token api_client_authorizations(api_client_auth_name).api_token
+    authorize_with_token api_client_authorizations(api_client_auth_name).token
   end
 
   def authorize_with_token token
     t = token
-    t = t.api_token if t.respond_to? :api_token
+    t = t.token if t.respond_to? :token
     ArvadosApiToken.new.call("rack.input" => "",
-                             "HTTP_AUTHORIZATION" => "OAuth2 #{t}")
+                             "HTTP_AUTHORIZATION" => "Bearer #{t}")
   end
 
   def salt_token(fixture:, remote:)