diff --git a/mistral/api/controllers/v2/types.py b/mistral/api/controllers/v2/types.py index f656d7639..2f0efac52 100644 --- a/mistral/api/controllers/v2/types.py +++ b/mistral/api/controllers/v2/types.py @@ -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): diff --git a/mistral/tests/unit/api/v2/test_actions.py b/mistral/tests/unit/api/v2/test_actions.py index c7238fa32..0378f9c75 100644 --- a/mistral/tests/unit/api/v2/test_actions.py +++ b/mistral/tests/unit/api/v2/test_actions.py @@ -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()) diff --git a/mistral/tests/unit/api/v2/test_executions.py b/mistral/tests/unit/api/v2/test_executions.py index 92556a80c..f8e382253 100644 --- a/mistral/tests/unit/api/v2/test_executions.py +++ b/mistral/tests/unit/api/v2/test_executions.py @@ -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()) diff --git a/mistral/tests/unit/api/v2/test_workflows.py b/mistral/tests/unit/api/v2/test_workflows.py index 6a30a11c8..ffaba6218 100644 --- a/mistral/tests/unit/api/v2/test_workflows.py +++ b/mistral/tests/unit/api/v2/test_workflows.py @@ -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):