[ARVADOS] updated: 1.1.1-218-ga879823
Git user
git at public.curoverse.com
Wed Dec 13 10:01:57 EST 2017
Summary of changes:
services/api/lib/record_filters.rb | 4 +--
.../api/test/functional/arvados/v1/filters_test.rb | 35 ++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
via a879823f631381cefc4458c28f06c36803e30530 (commit)
from 91dc5aafab57c131973244b771392cab083ab469 (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 a879823f631381cefc4458c28f06c36803e30530
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Wed Dec 13 10:01:38 2017 -0500
4019: More tests for error cases
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/lib/record_filters.rb b/services/api/lib/record_filters.rb
index 50837e1..dc427c1 100644
--- a/services/api/lib/record_filters.rb
+++ b/services/api/lib/record_filters.rb
@@ -66,8 +66,8 @@ module RecordFilters
col = model_class.columns.select { |c| c.name == subproperty[0] }.first
if subproperty.length == 2
- if col.type != :jsonb
- raise ArgumentError.new("Invalid attribute '#{subproperty[0]}' for operator '#{operator}' in filter")
+ if col.nil? or col.type != :jsonb
+ raise ArgumentError.new("Invalid attribute '#{subproperty[0]}' for subproperty filter")
end
if subproperty[1][0] == "<" and subproperty[1][-1] == ">"
diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb
index 4c14d23..ef120b1 100644
--- a/services/api/test/functional/arvados/v1/filters_test.rb
+++ b/services/api/test/functional/arvados/v1/filters_test.rb
@@ -230,6 +230,41 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
filters: [ ['properties.prop1', 'exists', nil] ]
}
assert_response 422
+ assert_match(/Invalid operand '' for 'exists' must be true or false/,
+ json_response['errors'].join(' '))
+ end
+
+ test "jsonb checks column exists" do
+ @controller = Arvados::V1::CollectionsController.new
+ authorize_with :admin
+ get :index, {
+ filters: [ ['puppies.prop1', '=', 'value1'] ]
+ }
+ assert_response 422
+ assert_match(/Invalid attribute 'puppies' for subproperty filter/,
+ json_response['errors'].join(' '))
+ end
+
+ test "jsonb checks column is valid" do
+ @controller = Arvados::V1::CollectionsController.new
+ authorize_with :admin
+ get :index, {
+ filters: [ ['name.prop1', '=', 'value1'] ]
+ }
+ assert_response 422
+ assert_match(/Invalid attribute 'name' for subproperty filter/,
+ json_response['errors'].join(' '))
+ end
+
+ test "jsonb invalid operator" do
+ @controller = Arvados::V1::CollectionsController.new
+ authorize_with :admin
+ get :index, {
+ filters: [ ['properties.prop1', '###', 'value1'] ]
+ }
+ assert_response 422
+ assert_match(/Invalid operator for subproperty search '###'/,
+ json_response['errors'].join(' '))
end
test "replication_desired = 2" do
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list