diff --git a/mistral/api/controllers/v2/environment.py b/mistral/api/controllers/v2/environment.py index 87fdcce5..b653116b 100644 --- a/mistral/api/controllers/v2/environment.py +++ b/mistral/api/controllers/v2/environment.py @@ -102,7 +102,7 @@ class EnvironmentController(rest.RestController): LOG.info("Create environment [env=%s]" % env) self._validate_environment( - json.loads(wsme_pecan.pecan.request.body), + json.loads(wsme_pecan.pecan.request.body.decode()), ['name', 'description', 'variables'] ) @@ -121,7 +121,7 @@ class EnvironmentController(rest.RestController): LOG.info("Update environment [name=%s, env=%s]" % (env.name, env)) - definition = json.loads(wsme_pecan.pecan.request.body) + definition = json.loads(wsme_pecan.pecan.request.body.decode()) definition.pop('name') self._validate_environment( diff --git a/mistral/tests/unit/api/v2/test_action_executions.py b/mistral/tests/unit/api/v2/test_action_executions.py index 2de7c58a..487d2c07 100644 --- a/mistral/tests/unit/api/v2/test_action_executions.py +++ b/mistral/tests/unit/api/v2/test_action_executions.py @@ -304,7 +304,10 @@ class TestActionExecutionsController(base.FunctionalTest): resp = self.app.delete('/v2/action_executions/123', expect_errors=True) self.assertEqual(403, resp.status_int) - self.assertIn("Action execution deletion is not allowed", resp.body) + self.assertIn( + "Action execution deletion is not allowed", + resp.body.decode() + ) @mock.patch.object(db_api, 'get_action_execution', MOCK_ACTION) def test_delete_action_exeuction_with_task(self): @@ -313,7 +316,10 @@ class TestActionExecutionsController(base.FunctionalTest): resp = self.app.delete('/v2/action_executions/123', expect_errors=True) self.assertEqual(403, resp.status_int) - self.assertIn("Only ad-hoc action execution can be deleted", resp.body) + self.assertIn( + "Only ad-hoc action execution can be deleted", + resp.body.decode() + ) @mock.patch.object( db_api, @@ -328,5 +334,5 @@ class TestActionExecutionsController(base.FunctionalTest): self.assertEqual(403, resp.status_int) self.assertIn( "Only completed action execution can be deleted", - resp.body + resp.body.decode() ) diff --git a/mistral/tests/unit/api/v2/test_actions.py b/mistral/tests/unit/api/v2/test_actions.py index 0378f9c7..eba899fc 100644 --- a/mistral/tests/unit/api/v2/test_actions.py +++ b/mistral/tests/unit/api/v2/test_actions.py @@ -303,7 +303,7 @@ class TestActionsController(base.FunctionalTest): self.assertEqual(400, resp.status_int) - self.assertIn("Limit must be positive", resp.body) + self.assertIn("Limit must be positive", resp.body.decode()) def test_get_all_pagination_limit_not_integer(self): resp = self.app.get( @@ -313,7 +313,7 @@ class TestActionsController(base.FunctionalTest): self.assertEqual(400, resp.status_int) - self.assertIn("unable to convert to int", resp.body) + self.assertIn("unable to convert to int", resp.body.decode()) def test_get_all_pagination_invalid_sort_dirs_length(self): resp = self.app.get( diff --git a/mistral/tests/unit/api/v2/test_executions.py b/mistral/tests/unit/api/v2/test_executions.py index f8e38225..4b953080 100644 --- a/mistral/tests/unit/api/v2/test_executions.py +++ b/mistral/tests/unit/api/v2/test_executions.py @@ -274,7 +274,7 @@ class TestExecutionsController(base.FunctionalTest): self.assertEqual(400, resp.status_int) - self.assertIn("Limit must be positive", resp.body) + self.assertIn("Limit must be positive", resp.body.decode()) def test_get_all_pagination_limit_not_integer(self): resp = self.app.get( @@ -284,7 +284,7 @@ class TestExecutionsController(base.FunctionalTest): self.assertEqual(400, resp.status_int) - self.assertIn("unable to convert to int", resp.body) + self.assertIn("unable to convert to int", resp.body.decode()) def test_get_all_pagination_invalid_sort_dirs_length(self): resp = self.app.get( diff --git a/mistral/tests/unit/api/v2/test_workbooks.py b/mistral/tests/unit/api/v2/test_workbooks.py index 19957e45..be29a723 100644 --- a/mistral/tests/unit/api/v2/test_workbooks.py +++ b/mistral/tests/unit/api/v2/test_workbooks.py @@ -146,7 +146,7 @@ class TestWorkbooksController(base.FunctionalTest): ) self.assertEqual(400, resp.status_int) - self.assertIn("Invalid DSL", resp.body) + self.assertIn("Invalid DSL", resp.body.decode()) @mock.patch.object(workbooks, "create_workbook_v2", MOCK_WORKBOOK) def test_post(self): @@ -179,7 +179,7 @@ class TestWorkbooksController(base.FunctionalTest): ) self.assertEqual(400, resp.status_int) - self.assertIn("Invalid DSL", resp.body) + self.assertIn("Invalid DSL", resp.body.decode()) @mock.patch.object(db_api, "delete_workbook", MOCK_DELETE) def test_delete(self): diff --git a/mistral/tests/unit/api/v2/test_workflows.py b/mistral/tests/unit/api/v2/test_workflows.py index ffaba621..3092444f 100644 --- a/mistral/tests/unit/api/v2/test_workflows.py +++ b/mistral/tests/unit/api/v2/test_workflows.py @@ -254,7 +254,7 @@ class TestWorkflowsController(base.FunctionalTest): ) self.assertEqual(400, resp.status_int) - self.assertIn("Invalid DSL", resp.body) + self.assertIn("Invalid DSL", resp.body.decode()) @mock.patch.object(db_api, "create_workflow_definition") def test_post(self, mock_mtd): @@ -325,7 +325,7 @@ class TestWorkflowsController(base.FunctionalTest): ) self.assertEqual(400, resp.status_int) - self.assertIn("Invalid DSL", resp.body) + self.assertIn("Invalid DSL", resp.body.decode()) @mock.patch.object(db_api, "delete_workflow_definition", MOCK_DELETE) @mock.patch.object(db_api, "get_workflow_definition", MOCK_WF) @@ -398,7 +398,7 @@ class TestWorkflowsController(base.FunctionalTest): self.assertEqual(400, resp.status_int) - self.assertIn("Limit must be positive", resp.body) + self.assertIn("Limit must be positive", resp.body.decode()) def test_get_all_pagination_limit_not_integer(self): resp = self.app.get( @@ -408,7 +408,7 @@ class TestWorkflowsController(base.FunctionalTest): self.assertEqual(400, resp.status_int) - self.assertIn("unable to convert to int", resp.body) + self.assertIn("unable to convert to int", resp.body.decode()) def test_get_all_pagination_invalid_sort_dirs_length(self): resp = self.app.get( diff --git a/mistral/tests/unit/test_coordination.py b/mistral/tests/unit/test_coordination.py index 4379090f..0b534b20 100644 --- a/mistral/tests/unit/test_coordination.py +++ b/mistral/tests/unit/test_coordination.py @@ -14,6 +14,7 @@ import mock from oslo_config import cfg +import six from mistral import coordination from mistral.tests import base @@ -94,7 +95,7 @@ class ServiceCoordinatorTest(base.BaseTest): members = coordinator.get_members('fake_group') self.assertEqual(1, len(members)) - self.assertItemsEqual(('fake_id',), members) + self.assertItemsEqual((six.b('fake_id'),), members) def test_join_group_and_leave_group(self): cfg.CONF.set_default( @@ -113,7 +114,7 @@ class ServiceCoordinatorTest(base.BaseTest): members_after = coordinator.get_members('fake_group') self.assertEqual(1, len(members_before)) - self.assertEqual(set(['fake_id']), members_before) + self.assertEqual(set([six.b('fake_id')]), members_before) self.assertEqual(0, len(members_after)) self.assertEqual(set([]), members_after) @@ -144,4 +145,4 @@ class ServiceTest(base.BaseTest): members = srv_coordinator.get_members('fake_group') mock_get_identifier.assert_called_once_with() - self.assertEqual(set(['fake_id']), members) + self.assertEqual(set([six.b('fake_id')]), members)