Use assertIn() to replace asserTrue(* in *)

Change-Id: Ie27a2bd0c90a320c5b65730185d3daaab38c443a
This commit is contained in:
LiuNanke 2016-12-14 18:51:26 +08:00
parent 3d7159ec6d
commit df8ad998cf
2 changed files with 10 additions and 10 deletions

View File

@ -878,8 +878,8 @@ class TestCatalogApi(test_base.ControllerTest, test_base.MuranoApiTestCase):
result = req.get_response(self.api)
self.assertEqual(406, result.status_code)
self.assertTrue(b'Acceptable response can not be provided'
in result.body)
self.assertIn(b'Acceptable response can not be provided',
result.body)
@mock.patch('murano.api.v1.catalog._validate_body')
@mock.patch('murano.common.policy.check')
@ -1067,8 +1067,8 @@ class TestCatalogApi(test_base.ControllerTest, test_base.MuranoApiTestCase):
result = req.get_response(self.api)
self.assertEqual(406, result.status_code)
self.assertTrue(b'Acceptable response can not be provided'
in result.body)
self.assertIn(b'Acceptable response can not be provided',
result.body)
def test_get_logo(self):
self._set_policy_rules(
@ -1102,8 +1102,8 @@ class TestCatalogApi(test_base.ControllerTest, test_base.MuranoApiTestCase):
result = req.get_response(self.api)
self.assertEqual(406, result.status_code)
self.assertTrue(b'Acceptable response can not be provided'
in result.body)
self.assertIn(b'Acceptable response can not be provided',
result.body)
def test_add_public_unauthorized(self):
self._set_policy_rules({

View File

@ -408,8 +408,8 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase):
"""Test abandon environment belongs to another tenant."""
result = self._test_delete_or_abandon(abandon=True, tenant='not_match')
self.assertEqual(403, result.status_code)
self.assertTrue((b'User is not authorized to access these'
b' tenant resources') in result.body)
self.assertIn((b'User is not authorized to access these'
b' tenant resources'), result.body)
def test_get_last_status_of_different_tenant(self):
"""Test get last services status of env belongs to another tenant."""
@ -417,8 +417,8 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase):
req = self._get('/environments/111/lastStatus', tenant='not_match')
result = req.get_response(self.api)
self.assertEqual(403, result.status_code)
self.assertTrue((b'User is not authorized to access these'
b' tenant resources') in result.body)
self.assertIn((b'User is not authorized to access these'
b' tenant resources'), result.body)
def test_get_environment(self):
"""Test GET request of an environment in ready status"""