[ARVADOS] updated: e8ccb474e5dbfee3d600fdd5ac3218ccb4625eb6
Git user
git at public.curoverse.com
Tue May 3 12:48:55 EDT 2016
Summary of changes:
sdk/python/tests/test_api.py | 2 +-
.../api/app/controllers/application_controller.rb | 4 +--
.../v1/api_client_authorizations_controller.rb | 2 +-
services/api/lib/eventbus.rb | 2 +-
services/api/lib/load_param.rb | 8 ++---
services/api/lib/record_filters.rb | 2 ++
.../integration/collections_performance_test.rb | 2 +-
services/api/test/integration/websocket_test.rb | 36 +++++++++++-----------
services/api/test/test_helper.rb | 2 +-
9 files changed, 31 insertions(+), 29 deletions(-)
via e8ccb474e5dbfee3d600fdd5ac3218ccb4625eb6 (commit)
via 12b5d95d9d4f062539c3d7d7ac8dd5421dd6b6b0 (commit)
from 7ea58af581ad8d1af39d5cbcc18ebb69100e0a5c (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 e8ccb474e5dbfee3d600fdd5ac3218ccb4625eb6
Merge: 7ea58af 12b5d95
Author: Tom Clegg <tom at curoverse.com>
Date: Tue May 3 12:48:01 2016 -0400
Merge branch '9119-oj-load-strict'
refs #9119
commit 12b5d95d9d4f062539c3d7d7ac8dd5421dd6b6b0
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue May 3 11:04:24 2016 -0400
9119: Use Oj strict mode for decoding JSON.
diff --git a/sdk/python/tests/test_api.py b/sdk/python/tests/test_api.py
index 795a9aa..6c379e1 100644
--- a/sdk/python/tests/test_api.py
+++ b/sdk/python/tests/test_api.py
@@ -37,7 +37,7 @@ class ArvadosApiTest(run_test_server.TestCaseWithServers):
def test_empty_list(self):
answer = arvados.api('v1').humans().list(
- filters=[['uuid', 'is', None]]).execute()
+ filters=[['uuid', '=', None]]).execute()
self.assertEqual(answer['items_available'], len(answer['items']))
def test_nonempty_list(self):
diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index e91e3ce..3a88818 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -327,7 +327,7 @@ class ApplicationController < ActionController::Base
return @attrs if @attrs
@attrs = params[resource_name]
if @attrs.is_a? String
- @attrs = Oj.load @attrs, symbol_keys: true
+ @attrs = Oj.strict_load @attrs, symbol_keys: true
end
unless @attrs.is_a? Hash
message = "No #{resource_name}"
@@ -441,7 +441,7 @@ class ApplicationController < ActionController::Base
def load_json_value(hash, key, must_be_class=nil)
if hash[key].is_a? String
- hash[key] = Oj.load(hash[key], symbol_keys: false)
+ hash[key] = Oj.strict_load(hash[key], symbol_keys: false)
if must_be_class and !hash[key].is_a? must_be_class
raise TypeError.new("parameter #{key.to_s} must be a #{must_be_class.to_s}")
end
diff --git a/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb b/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
index 83968be..5229d80 100644
--- a/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
+++ b/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
@@ -15,7 +15,7 @@ class Arvados::V1::ApiClientAuthorizationsController < ApplicationController
new(user_id: system_user.id,
api_client_id: params[:api_client_id] || current_api_client.andand.id,
created_by_ip_address: remote_ip,
- scopes: Oj.load(params[:scopes] || '["all"]'))
+ scopes: Oj.strict_load(params[:scopes] || '["all"]'))
@object.save!
show
end
diff --git a/services/api/lib/eventbus.rb b/services/api/lib/eventbus.rb
index ac53876..9bf95f5 100644
--- a/services/api/lib/eventbus.rb
+++ b/services/api/lib/eventbus.rb
@@ -162,7 +162,7 @@ class EventBus
begin
begin
# Parse event data as JSON
- p = (Oj.load event.data).symbolize_keys
+ p = (Oj.strict_load event.data).symbolize_keys
filter = Filter.new(p)
rescue Oj::Error => e
ws.send ({status: 400, message: "malformed request"}.to_json)
diff --git a/services/api/lib/load_param.rb b/services/api/lib/load_param.rb
index d7b9bb7..5b22274 100644
--- a/services/api/lib/load_param.rb
+++ b/services/api/lib/load_param.rb
@@ -17,7 +17,7 @@ module LoadParam
@where = params[:where]
elsif params[:where].is_a? String
begin
- @where = Oj.load(params[:where])
+ @where = Oj.strict_load(params[:where])
raise unless @where.is_a? Hash
rescue
raise ArgumentError.new("Could not parse \"where\" param as an object")
@@ -33,7 +33,7 @@ module LoadParam
@filters += params[:filters]
elsif params[:filters].is_a? String and !params[:filters].empty?
begin
- f = Oj.load params[:filters]
+ f = Oj.strict_load params[:filters]
if not f.nil?
raise unless f.is_a? Array
@filters += f
@@ -72,7 +72,7 @@ module LoadParam
(case params[:order]
when String
if params[:order].starts_with? '['
- od = Oj.load(params[:order])
+ od = Oj.strict_load(params[:order])
raise unless od.is_a? Array
od
else
@@ -142,7 +142,7 @@ module LoadParam
@select = params[:select]
when String
begin
- @select = Oj.load params[:select]
+ @select = Oj.strict_load params[:select]
raise unless @select.is_a? Array or @select.nil?
rescue
raise ArgumentError.new("Could not parse \"select\" param as an array")
diff --git a/services/api/lib/record_filters.rb b/services/api/lib/record_filters.rb
index 350c380..caf62c7 100644
--- a/services/api/lib/record_filters.rb
+++ b/services/api/lib/record_filters.rb
@@ -126,6 +126,8 @@ module RecordFilters
end
end
cond_out << cond.join(' OR ')
+ else
+ raise ArgumentError.new("Invalid operator '#{operator}'")
end
end
conds_out << cond_out.join(' OR ') if cond_out.any?
diff --git a/services/api/test/integration/collections_performance_test.rb b/services/api/test/integration/collections_performance_test.rb
index 634ac11..77a26e5 100644
--- a/services/api/test/integration/collections_performance_test.rb
+++ b/services/api/test/integration/collections_performance_test.rb
@@ -14,7 +14,7 @@ class CollectionsApiPerformanceTest < ActionDispatch::IntegrationTest
api_token: api_token(:active))
end
json = time_block "JSON encode #{bigmanifest.length>>20}MiB manifest" do
- Oj.dump({manifest_text: bigmanifest})
+ Oj.dump({"manifest_text" => bigmanifest})
end
time_block 'create' do
post '/arvados/v1/collections', {collection: json}, auth(:active)
diff --git a/services/api/test/integration/websocket_test.rb b/services/api/test/integration/websocket_test.rb
index c4d6d5e..313a22d 100644
--- a/services/api/test/integration/websocket_test.rb
+++ b/services/api/test/integration/websocket_test.rb
@@ -56,7 +56,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
ws_helper do |ws|
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
status = d["status"]
ws.close
end
@@ -75,7 +75,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
status = d["status"]
ws.close
end
@@ -97,7 +97,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -134,7 +134,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -174,7 +174,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -213,7 +213,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -257,7 +257,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -297,7 +297,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -342,7 +342,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -390,7 +390,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -435,7 +435,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -507,7 +507,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -531,7 +531,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
status = d["status"]
ws.close
end
@@ -549,7 +549,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
status = d["status"]
ws.close
end
@@ -567,7 +567,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
status = d["status"]
ws.close
end
@@ -590,7 +590,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when (1..EventBus::MAX_FILTERS)
assert_equal 200, d["status"]
@@ -625,7 +625,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
@@ -664,7 +664,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
ws.on :message do |event|
- d = Oj.load event.data
+ d = Oj.strict_load event.data
case state
when 1
assert_equal 200, d["status"]
diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index 197ae24..881a080 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -26,7 +26,7 @@ require 'mocha/mini_test'
module ArvadosTestSupport
def json_response
- Oj.load response.body
+ Oj.strict_load response.body
end
def api_token(api_client_auth_name)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list