[ARVADOS] created: 1.2.0-112-g0bcda6fc8

Git user git at public.curoverse.com
Tue Oct 2 13:57:07 EDT 2018


        at  0bcda6fc8359eed616051d22caa63bde29d7cd18 (commit)


commit 0bcda6fc8359eed616051d22caa63bde29d7cd18
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Tue Oct 2 13:56:16 2018 -0400

    14274: Fix FactoryGirl deprication warning (renamed to FactoryBot)
    
    Also fix "mocha/mini_test" -> "mocha/minitest" warning.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/api/Gemfile b/services/api/Gemfile
index 0dc38f1e7..5cf854b52 100644
--- a/services/api/Gemfile
+++ b/services/api/Gemfile
@@ -9,7 +9,7 @@ gem 'responders', '~> 2.0'
 gem 'protected_attributes'
 
 group :test, :development do
-  gem 'factory_girl_rails'
+  gem 'factory_bot_rails'
   gem 'database_cleaner'
   gem 'ruby-prof'
   # Note: "require: false" here tells bunder not to automatically
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index f935f2c07..3cf79b2d8 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -93,10 +93,10 @@ GEM
     eventmachine (1.2.6)
     execjs (2.7.0)
     extlib (0.9.16)
-    factory_girl (4.9.0)
+    factory_bot (4.11.1)
       activesupport (>= 3.0.0)
-    factory_girl_rails (4.9.0)
-      factory_girl (~> 4.9.0)
+    factory_bot_rails (4.11.1)
+      factory_bot (~> 4.11.1)
       railties (>= 3.0.0)
     faraday (0.12.2)
       multipart-post (>= 1.2, < 3)
@@ -294,7 +294,7 @@ DEPENDENCIES
   arvados-cli
   coffee-rails (~> 4.0)
   database_cleaner
-  factory_girl_rails
+  factory_bot_rails
   faye-websocket
   httpclient
   jquery-rails
diff --git a/services/api/test/factories/api_client.rb b/services/api/test/factories/api_client.rb
index 55f795702..ee2017bf7 100644
--- a/services/api/test/factories/api_client.rb
+++ b/services/api/test/factories/api_client.rb
@@ -2,9 +2,9 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-FactoryGirl.define do
+FactoryBot.define do
   factory :api_client do
-    is_trusted false
+    is_trusted { false }
     to_create do |instance|
       CurrentApiClientHelper.act_as_system_user do
         instance.save!
diff --git a/services/api/test/factories/api_client_authorization.rb b/services/api/test/factories/api_client_authorization.rb
index f5e3ab4cc..af2660a5f 100644
--- a/services/api/test/factories/api_client_authorization.rb
+++ b/services/api/test/factories/api_client_authorization.rb
@@ -2,10 +2,10 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-FactoryGirl.define do
+FactoryBot.define do
   factory :api_client_authorization do
     api_client
-    scopes ['all']
+    scopes { ['all'] }
 
     trait :trusted do
       association :api_client, factory: :api_client, is_trusted: true
diff --git a/services/api/test/factories/group.rb b/services/api/test/factories/group.rb
index dcff78318..7af57354b 100644
--- a/services/api/test/factories/group.rb
+++ b/services/api/test/factories/group.rb
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-FactoryGirl.define do
+FactoryBot.define do
   factory :group do
   end
 end
diff --git a/services/api/test/factories/link.rb b/services/api/test/factories/link.rb
index 00f463d37..291a04e0c 100644
--- a/services/api/test/factories/link.rb
+++ b/services/api/test/factories/link.rb
@@ -2,10 +2,10 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-FactoryGirl.define do
+FactoryBot.define do
   factory :link do
     factory :permission_link do
-      link_class 'permission'
+      link_class { 'permission' }
     end
   end
 end
diff --git a/services/api/test/factories/user.rb b/services/api/test/factories/user.rb
index 344e571ef..91d939516 100644
--- a/services/api/test/factories/user.rb
+++ b/services/api/test/factories/user.rb
@@ -6,10 +6,10 @@ class CurrentApiClientHelper
   extend CurrentApiClient
 end
 
-FactoryGirl.define do
+FactoryBot.define do
   factory :user do
     transient do
-      join_groups []
+      join_groups { [] }
     end
     after :create do |user, evaluator|
       CurrentApiClientHelper.act_as_system_user do
@@ -25,13 +25,13 @@ FactoryGirl.define do
         end
       end
     end
-    first_name "Factory"
-    last_name "Factory"
+    first_name { "Factory" }
+    last_name { "Factory" }
     identity_url do
       "https://example.com/#{rand(2**24).to_s(36)}"
     end
     factory :active_user do
-      is_active true
+      is_active { true }
       after :create do |user|
         CurrentApiClientHelper.act_as_system_user do
           Link.create!(tail_uuid: user.uuid,
diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index e4b86e93c..ffd50d808 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -33,7 +33,7 @@ end
 require File.expand_path('../../config/environment', __FILE__)
 require 'rails/test_help'
 require 'mocha'
-require 'mocha/mini_test'
+require 'mocha/minitest'
 
 module ArvadosTestSupport
   def json_response
@@ -54,7 +54,7 @@ module ArvadosTestSupport
 end
 
 class ActiveSupport::TestCase
-  include FactoryGirl::Syntax::Methods
+  include FactoryBot::Syntax::Methods
   fixtures :all
 
   include ArvadosTestSupport

commit 4503336797b79519f8c480af39fb72538191038a
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Tue Oct 2 13:18:33 2018 -0400

    14196: Login process returns v2 tokens
    
    Unit/functional/integration tests now use v2 tokens by default.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index 8589b3c7a..8b20c0c16 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -344,13 +344,20 @@ class ApplicationController < ActionController::Base
     # If there are too many reader tokens, assume the request is malicious
     # and ignore it.
     if request.get? and params[:reader_tokens] and
-        params[:reader_tokens].size < 100
+      params[:reader_tokens].size < 100
+      secrets = params[:reader_tokens].map { |t|
+        if t.starts_with? "v2/"
+          t.split("/")[2]
+        else
+          t
+        end
+      }
       @read_auths += ApiClientAuthorization
         .includes(:user)
         .where('api_token IN (?) AND
                 (expires_at IS NULL OR expires_at > CURRENT_TIMESTAMP)',
-               params[:reader_tokens])
-        .all
+               secrets)
+        .to_a
     end
     @read_auths.select! { |auth| auth.scopes_allow_request? request }
     @read_users = @read_auths.map(&:user).uniq
diff --git a/services/api/app/controllers/user_sessions_controller.rb b/services/api/app/controllers/user_sessions_controller.rb
index b8fe29489..020dfa53b 100644
--- a/services/api/app/controllers/user_sessions_controller.rb
+++ b/services/api/app/controllers/user_sessions_controller.rb
@@ -159,7 +159,7 @@ class UserSessionsController < ApplicationController
     else
       callback_url += '?'
     end
-    callback_url += 'api_token=' + api_client_auth.api_token
+    callback_url += 'api_token=' + api_client_auth.token
     redirect_to callback_url
   end
 
diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index 73b45f95e..e4b86e93c 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -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:)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list