Fix compatibility with WebOb 1.6.0

THe new WebOb release got stricter on the way Response text can be
retrieved for JSON responses. This fixes the issue by checking the body
instead in tests.

Change-Id: I45670bbebda9220ff3e69f10590d20dbc605f4a7
This commit is contained in:
Thomas Herve 2016-03-16 10:43:21 +01:00
parent 8a2d4b29d7
commit cc45eeaf81
2 changed files with 14 additions and 6 deletions

View File

@ -164,8 +164,10 @@ class TestActionsController(base.FunctionalTest):
)
self.assertEqual(400, resp.status_int)
self.assertIn('Attempt to modify a system action: std.echo',
resp.text)
self.assertIn(
'Attempt to modify a system action: std.echo',
resp.body.decode()
)
@mock.patch.object(db_api, "create_action_definition")
def test_post(self, mock_mtd):
@ -218,7 +220,7 @@ class TestActionsController(base.FunctionalTest):
)
self.assertEqual(400, resp.status_int)
self.assertIn("Scope must be one of the following", resp.text)
self.assertIn("Scope must be one of the following", resp.body.decode())
@mock.patch.object(db_api, "create_action_definition", MOCK_DUPLICATE)
def test_post_dup(self):

View File

@ -233,7 +233,10 @@ class TestWorkflowsController(base.FunctionalTest):
)
self.assertEqual(400, resp.status_int)
self.assertIn("Attempt to modify a system workflow", resp.text)
self.assertIn(
"Attempt to modify a system workflow",
resp.body.decode()
)
@mock.patch.object(db_api, "update_workflow_definition")
def test_put_public(self, mock_update):
@ -350,7 +353,7 @@ class TestWorkflowsController(base.FunctionalTest):
)
self.assertEqual(400, resp.status_int)
self.assertIn("Scope must be one of the following", resp.text)
self.assertIn("Scope must be one of the following", resp.body.decode())
@mock.patch.object(db_api, "create_workflow_definition", MOCK_DUPLICATE)
def test_post_dup(self):
@ -389,7 +392,10 @@ class TestWorkflowsController(base.FunctionalTest):
resp = self.app.delete('/v2/workflows/123', expect_errors=True)
self.assertEqual(400, resp.status_int)
self.assertIn("Attempt to delete a system workflow", resp.text)
self.assertIn(
"Attempt to delete a system workflow",
resp.body.decode()
)
@mock.patch.object(db_api, "delete_workflow_definition", MOCK_NOT_FOUND)
def test_delete_not_found(self):