[arvados] updated: 2.7.0-5107-g14c8fb3d5a

git repository hosting git at public.arvados.org
Tue Oct 31 19:11:16 UTC 2023


Summary of changes:
 .../functional/arvados/v1/users_controller_test.rb |  2 +-
 .../api_client_authorizations_scopes_test.rb       | 51 ++++++++++++----------
 services/api/test/integration/cross_origin_test.rb |  4 +-
 services/api/test/test_helper.rb                   | 12 ++---
 4 files changed, 36 insertions(+), 33 deletions(-)

       via  14c8fb3d5ae381e6bc0609530209ee7f7a584fe3 (commit)
       via  365e79dc8fdeeed324c3e6f4f20ce200f4d28c3c (commit)
      from  88e18b7b9826b05e8485a6a99593ecda850969d7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 14c8fb3d5ae381e6bc0609530209ee7f7a584fe3
Author: Tom Clegg <tom at curii.com>
Date:   Tue Oct 31 15:11:04 2023 -0400

    20846: More kwargs / Ruby 3 compatibility fixes.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/api/test/functional/arvados/v1/users_controller_test.rb b/services/api/test/functional/arvados/v1/users_controller_test.rb
index 6a9cb74195..16271c9e8f 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -68,7 +68,7 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
 
   test "respond 401 if given token exists but user record is missing" do
     authorize_with :valid_token_deleted_user
-    get :current, {format: :json}
+    get :current, format: :json
     assert_response 401
   end
 
diff --git a/services/api/test/integration/api_client_authorizations_scopes_test.rb b/services/api/test/integration/api_client_authorizations_scopes_test.rb
index d015e450a6..3b28a3163f 100644
--- a/services/api/test/integration/api_client_authorizations_scopes_test.rb
+++ b/services/api/test/integration/api_client_authorizations_scopes_test.rb
@@ -16,40 +16,43 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
   end
 
   test "user list token can only list users" do
-    get_args = [params: {}, headers: auth(:active_userlist)]
-    get(v1_url('users'), *get_args)
+    get_args = {params: {}, headers: auth(:active_userlist)}
+    get(v1_url('users'), **get_args)
     assert_response :success
-    get(v1_url('users', ''), *get_args)  # Add trailing slash.
+    get(v1_url('users', ''), **get_args)  # Add trailing slash.
     assert_response :success
-    get(v1_url('users', 'current'), *get_args)
+    get(v1_url('users', 'current'), **get_args)
     assert_response 403
-    get(v1_url('virtual_machines'), *get_args)
+    get(v1_url('virtual_machines'), **get_args)
     assert_response 403
   end
 
   test "narrow + wide scoped tokens for different users" do
-    get_args = [params: {
-                  reader_tokens: [api_client_authorizations(:anonymous).api_token]
-                }, headers: auth(:active_userlist)]
-    get(v1_url('users'), *get_args)
+    get_args = {
+      params: {
+        reader_tokens: [api_client_authorizations(:anonymous).api_token]
+      },
+      headers: auth(:active_userlist),
+    }
+    get(v1_url('users'), **get_args)
     assert_response :success
-    get(v1_url('users', ''), *get_args)  # Add trailing slash.
+    get(v1_url('users', ''), **get_args)  # Add trailing slash.
     assert_response :success
-    get(v1_url('users', 'current'), *get_args)
+    get(v1_url('users', 'current'), **get_args)
     assert_response 403
-    get(v1_url('virtual_machines'), *get_args)
+    get(v1_url('virtual_machines'), **get_args)
     assert_response 403
    end
 
   test "specimens token can see exactly owned specimens" do
-    get_args = [params: {}, headers: auth(:active_specimens)]
-    get(v1_url('specimens'), *get_args)
+    get_args = {params: {}, headers: auth(:active_specimens)}
+    get(v1_url('specimens'), **get_args)
     assert_response 403
-    get(v1_url('specimens', specimens(:owned_by_active_user).uuid), *get_args)
+    get(v1_url('specimens', specimens(:owned_by_active_user).uuid), **get_args)
     assert_response :success
-    head(v1_url('specimens', specimens(:owned_by_active_user).uuid), *get_args)
+    head(v1_url('specimens', specimens(:owned_by_active_user).uuid), **get_args)
     assert_response :success
-    get(v1_url('specimens', specimens(:owned_by_spectator).uuid), *get_args)
+    get(v1_url('specimens', specimens(:owned_by_spectator).uuid), **get_args)
     assert_includes(403..404, @response.status)
   end
 
@@ -82,12 +85,12 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
   test "token without scope has no access" do
     # Logs are good for this test, because logs have relatively
     # few access controls enforced at the model level.
-    req_args = [params: {}, headers: auth(:admin_noscope)]
-    get(v1_url('logs'), *req_args)
+    req_args = {params: {}, headers: auth(:admin_noscope)}
+    get(v1_url('logs'), **req_args)
     assert_response 403
-    get(v1_url('logs', logs(:noop).uuid), *req_args)
+    get(v1_url('logs', logs(:noop).uuid), **req_args)
     assert_response 403
-    post(v1_url('logs'), *req_args)
+    post(v1_url('logs'), **req_args)
     assert_response 403
   end
 
@@ -97,10 +100,10 @@ class ApiTokensScopeTest < ActionDispatch::IntegrationTest
     def vm_logins_url(name)
       v1_url('virtual_machines', virtual_machines(name).uuid, 'logins')
     end
-    get_args = [params: {}, headers: auth(:admin_vm)]
-    get(vm_logins_url(:testvm), *get_args)
+    get_args = {params: {}, headers: auth(:admin_vm)}
+    get(vm_logins_url(:testvm), **get_args)
     assert_response :success
-    get(vm_logins_url(:testvm2), *get_args)
+    get(vm_logins_url(:testvm2), **get_args)
     assert_includes(400..419, @response.status,
                     "getting testvm2 logins should have failed")
   end
diff --git a/services/api/test/integration/cross_origin_test.rb b/services/api/test/integration/cross_origin_test.rb
index e3099f1573..6a3db89fc4 100644
--- a/services/api/test/integration/cross_origin_test.rb
+++ b/services/api/test/integration/cross_origin_test.rb
@@ -5,10 +5,10 @@
 require 'test_helper'
 
 class CrossOriginTest < ActionDispatch::IntegrationTest
-  def options *args
+  def options path, **kwargs
     # Rails doesn't support OPTIONS the same way as GET, POST, etc.
     reset! unless integration_session
-    integration_session.__send__(:process, :options, *args).tap do
+    integration_session.__send__(:process, :options, path, **kwargs).tap do
       copy_session_variables!
     end
   end

commit 365e79dc8fdeeed324c3e6f4f20ce200f4d28c3c
Author: Tom Clegg <tom at curii.com>
Date:   Tue Oct 31 10:29:55 2023 -0400

    20846: Fix kwargs variable name.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index e907367446..0255d8907d 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -179,21 +179,21 @@ class ActionController::TestCase
   end
 
   [:get, :post, :put, :patch, :delete].each do |method|
-    define_method method do |action, **args|
+    define_method method do |action, **kwargs|
       check_counter action
       # After Rails 5.0 upgrade, some params don't get properly serialized.
       # One case are filters: [['attr', 'op', 'val']] become [['attr'], ['op'], ['val']]
       # if not passed upstream as a JSON string.
-      if args[:params].is_a?(Hash)
-        args[:params].each do |key, _|
+      if kwargs[:params].is_a?(Hash)
+        kwargs[:params].each do |key, _|
           next if key == :exclude_script_versions # Job Reuse tests
           # Keys could be: :filters, :where, etc
-          if [Array, Hash].include?(args[:params][key].class)
-            args[:params][key] = SafeJSON.dump(args[:params][key])
+          if [Array, Hash].include?(kwargs[:params][key].class)
+            kwargs[:params][key] = SafeJSON.dump(kwargs[:params][key])
           end
         end
       end
-      super action, **args
+      super action, **kwargs
     end
   end
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list