Merge "Don't allow queries with 'IN' predicate with an empty sequence"
This commit is contained in:
commit
b6de8ddc0d
@ -1167,7 +1167,8 @@ class ValidatedComplexQuery(object):
|
||||
schema_value_in = {
|
||||
"type": "array",
|
||||
"items": {"oneOf": [{"type": "string"},
|
||||
{"type": "number"}]}}
|
||||
{"type": "number"}]},
|
||||
"minItems": 1}
|
||||
|
||||
schema_field = {
|
||||
"type": "object",
|
||||
|
@ -392,3 +392,9 @@ class TestFilterSyntaxValidation(test.BaseTestCase):
|
||||
self.assertRaises(jsonschema.ValidationError,
|
||||
self.query._validate_filter,
|
||||
filter)
|
||||
|
||||
def test_empty_in_query_not_passing(self):
|
||||
filter = {"in": {"resource_id": []}}
|
||||
self.assertRaises(jsonschema.ValidationError,
|
||||
self.query._validate_filter,
|
||||
filter)
|
||||
|
@ -943,11 +943,6 @@ class ComplexSampleQueryTest(DBTestBase,
|
||||
self.assertTrue(sample.counter_volume > 0.4)
|
||||
self.assertTrue(sample.counter_volume <= 0.8)
|
||||
|
||||
def test_query_filter_with_empty_in(self):
|
||||
results = list(
|
||||
self.conn.query_samples(filter_expr={"in": {"resource_id": []}}))
|
||||
self.assertEqual(len(results), 0)
|
||||
|
||||
def test_query_simple_metadata_filter(self):
|
||||
self._create_samples()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user