Merge "Add decode() function for string comparison."
This commit is contained in:
commit
e2be2adcdc
@ -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(
|
||||
|
@ -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()
|
||||
)
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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):
|
||||
|
@ -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(
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user