Merge "Use assertIn where appropriate"

This commit is contained in:
Jenkins 2014-02-22 03:23:36 +00:00 committed by Gerrit Code Review
commit 58a7e01b8f
7 changed files with 19 additions and 19 deletions

View File

@ -164,8 +164,8 @@ class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base):
self.mox.VerifyAll()
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
self.assertTrue('bytes_in' in _str)
self.assertTrue('bytes_out' in _str)
self.assertIn('bytes_in', _str)
self.assertIn('bytes_out', _str)
class CLITestV20LbPoolXML(CLITestV20LbPoolJSON):

View File

@ -44,8 +44,8 @@ class CLITestArgs(testtools.TestCase):
def test_nargs(self):
_specs = ['--tag', 'x', 'y', '--arg1', 'value1']
_mydict = neutronV20.parse_args_to_dict(_specs)
self.assertTrue('x' in _mydict['tag'])
self.assertTrue('y' in _mydict['tag'])
self.assertIn('x', _mydict['tag'])
self.assertIn('y', _mydict['tag'])
def test_badarg(self):
_specs = ['--tag=t', 'x', 'y', '--arg1', 'value1']

View File

@ -236,9 +236,9 @@ class CLITestV20Base(testtools.TestCase):
self.mox.VerifyAll()
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
self.assertTrue(myid in _str)
self.assertIn(myid, _str)
if name:
self.assertTrue(name in _str)
self.assertIn(name, _str)
def _test_list_columns(self, cmd, resources_collection,
resources_out, args=['-f', 'json']):
@ -354,7 +354,7 @@ class CLITestV20Base(testtools.TestCase):
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
if response_contents is None:
self.assertTrue('myid1' in _str)
self.assertIn('myid1', _str)
return _str
def _test_list_resources_with_pagination(self, resources, cmd):
@ -416,7 +416,7 @@ class CLITestV20Base(testtools.TestCase):
self.mox.VerifyAll()
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
self.assertTrue(myid in _str)
self.assertIn(myid, _str)
def _test_show_resource(self, resource, cmd, myid, args, fields=[]):
self.mox.StubOutWithMock(cmd, "get_client")
@ -441,8 +441,8 @@ class CLITestV20Base(testtools.TestCase):
self.mox.VerifyAll()
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
self.assertTrue(myid in _str)
self.assertTrue('myname' in _str)
self.assertIn(myid, _str)
self.assertIn('myname', _str)
def _test_delete_resource(self, resource, cmd, myid, args):
self.mox.StubOutWithMock(cmd, "get_client")
@ -461,7 +461,7 @@ class CLITestV20Base(testtools.TestCase):
self.mox.VerifyAll()
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
self.assertTrue(myid in _str)
self.assertIn(myid, _str)
def _test_update_resource_action(self, resource, cmd, myid, action, args,
body, retval=None):
@ -482,7 +482,7 @@ class CLITestV20Base(testtools.TestCase):
self.mox.VerifyAll()
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
self.assertTrue(myid in _str)
self.assertIn(myid, _str)
class ClientV2UnicodeTestJson(CLITestV20Base):

View File

@ -33,9 +33,9 @@ class CLITestV20Extension(CLITestV20Base):
response_contents=contents)
ret_words = set(ret.split())
# Check only the default columns are shown.
self.assertTrue('name' in ret_words)
self.assertTrue('alias' in ret_words)
self.assertFalse('other' in ret_words)
self.assertIn('name', ret_words)
self.assertIn('alias', ret_words)
self.assertNotIn('other', ret_words)
def test_show_extension(self):
# -F option does not work for ext-show at the moment, so -F option

View File

@ -388,7 +388,7 @@ class CLITestV20NetworkJSON(test_cli20.CLITestV20Base):
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
self.assertTrue('myid1' in _str)
self.assertIn('myid1', _str)
def test_list_external_nets_detail(self):
"""list external nets: -D."""

View File

@ -285,7 +285,7 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base):
self.mox.UnsetStubs()
_str = self.fake_stdout.make_string()
self.assertTrue('myid1' in _str)
self.assertIn('myid1', _str)
def test_list_router_ports(self):
"""List router ports: -D."""

View File

@ -109,7 +109,7 @@ class CLITestNameorID(testtools.TestCase):
neutronV20.find_resourceid_by_name_or_id(
self.client, 'network', name)
except exceptions.NeutronClientNoUniqueMatch as ex:
self.assertTrue('Multiple' in ex.message)
self.assertIn('Multiple', ex.message)
def test_get_id_from_name_notfound(self):
name = 'myname'
@ -127,5 +127,5 @@ class CLITestNameorID(testtools.TestCase):
neutronV20.find_resourceid_by_name_or_id(
self.client, 'network', name)
except exceptions.NeutronClientException as ex:
self.assertTrue('Unable to find' in ex.message)
self.assertIn('Unable to find', ex.message)
self.assertEqual(404, ex.status_code)