Refactored filter implementation.
1) Previously filter() was used to remove empty fields which creates problem while calulating length. 2) respose.body is returning byte literal string. So decode() function is used to convert it in simple string. Change-Id: I5e36dcb0a7482b030ca249248b5cbf8d14142c04 Partially-Implements: blueprint mistral-py3
This commit is contained in:
parent
a9ec61ed98
commit
078fbdafaf
@ -35,8 +35,8 @@ class ListType(wtypes.UserType):
|
||||
"""
|
||||
items = [v.strip().lower() for v in six.text_type(value).split(',')]
|
||||
|
||||
# filter() to remove empty items.
|
||||
return filter(None, items)
|
||||
# remove empty items.
|
||||
return [x for x in items if x]
|
||||
|
||||
@staticmethod
|
||||
def frombasetype(value):
|
||||
|
@ -325,7 +325,7 @@ class TestActionsController(base.FunctionalTest):
|
||||
|
||||
self.assertIn(
|
||||
"Length of sort_keys must be equal or greater than sort_dirs",
|
||||
resp.body
|
||||
resp.body.decode()
|
||||
)
|
||||
|
||||
def test_get_all_pagination_unknown_direction(self):
|
||||
@ -336,4 +336,4 @@ class TestActionsController(base.FunctionalTest):
|
||||
|
||||
self.assertEqual(400, resp.status_int)
|
||||
|
||||
self.assertIn("Unknown sort direction", resp.body)
|
||||
self.assertIn("Unknown sort direction", resp.body.decode())
|
||||
|
@ -296,7 +296,7 @@ class TestExecutionsController(base.FunctionalTest):
|
||||
|
||||
self.assertIn(
|
||||
"Length of sort_keys must be equal or greater than sort_dirs",
|
||||
resp.body
|
||||
resp.body.decode()
|
||||
)
|
||||
|
||||
def test_get_all_pagination_unknown_direction(self):
|
||||
@ -307,4 +307,4 @@ class TestExecutionsController(base.FunctionalTest):
|
||||
|
||||
self.assertEqual(400, resp.status_int)
|
||||
|
||||
self.assertIn("Unknown sort direction", resp.body)
|
||||
self.assertIn("Unknown sort direction", resp.body.decode())
|
||||
|
@ -420,7 +420,7 @@ class TestWorkflowsController(base.FunctionalTest):
|
||||
|
||||
self.assertIn(
|
||||
"Length of sort_keys must be equal or greater than sort_dirs",
|
||||
resp.body
|
||||
resp.body.decode()
|
||||
)
|
||||
|
||||
def test_get_all_pagination_unknown_direction(self):
|
||||
@ -431,7 +431,7 @@ class TestWorkflowsController(base.FunctionalTest):
|
||||
|
||||
self.assertEqual(400, resp.status_int)
|
||||
|
||||
self.assertIn("Unknown sort direction", resp.body)
|
||||
self.assertIn("Unknown sort direction", resp.body.decode())
|
||||
|
||||
@mock.patch('mistral.db.v2.api.get_workflow_definitions')
|
||||
def test_get_all_with_fields_filter(self, mock_get_db_wfs):
|
||||
@ -461,7 +461,7 @@ class TestWorkflowsController(base.FunctionalTest):
|
||||
|
||||
self.assertIn(
|
||||
"nonexist are invalid",
|
||||
resp.body
|
||||
resp.body.decode()
|
||||
)
|
||||
|
||||
def test_validate(self):
|
||||
|
Loading…
Reference in New Issue
Block a user