Removes whitespace from CLI queries
Strips leading and trailing whitespaces from CLI query field and value parameter before building url. Closes-Bug: 1464694 Change-Id: Ibe99747e22afe05eee187d59aaf0603f58e91373
This commit is contained in:
@@ -237,3 +237,17 @@ class CliTest(utils.BaseTestCase):
|
||||
'type': 'datetime',
|
||||
'value': '2014-03-11T16:02:58'}],
|
||||
ar)
|
||||
|
||||
def test_with_whitespace(self):
|
||||
ar = options.cli_to_array('start_timestamp= 2015-01-01T00:00:00;'
|
||||
' end_timestamp =2015-06-20T14:01:59 ')
|
||||
|
||||
self.assertEqual([{'field': 'start_timestamp',
|
||||
'op': 'eq',
|
||||
'type': '',
|
||||
'value': '2015-01-01T00:00:00'},
|
||||
{'field': 'end_timestamp',
|
||||
'op': 'eq',
|
||||
'type': '',
|
||||
'value': '2015-06-20T14:01:59'}],
|
||||
ar)
|
||||
|
||||
@@ -99,7 +99,7 @@ def cli_to_array(cli_query):
|
||||
if not len(value):
|
||||
_value_error('value')
|
||||
|
||||
return field, operator, value
|
||||
return field.strip(), operator, value.strip()
|
||||
|
||||
def split_by_data_type(query_value):
|
||||
frags = DATA_TYPE_RE.match(query_value)
|
||||
|
||||
Reference in New Issue
Block a user