summaryrefslogtreecommitdiff
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-10-22 14:09:53 +0000
committerGerrit Code Review <review@openstack.org>2013-10-22 14:09:53 +0000
commit19ea0c8c83b20692ee1e7572079388cbd9d8681a (patch)
tree76d13d248bee521a5f74621cbe62b593ba6ceaca /nova
parentd8697abebeb20629eb7cd7646ca0b79af72a9fca (diff)
parent184dfaaaa89ef8869e7cb54a6ea794a3ddc454a1 (diff)
downloadnova-19ea0c8c83b20692ee1e7572079388cbd9d8681a.tar.gz
Merge "Utilizes assertIn - tests/etc"
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/compute/test_compute.py96
-rw-r--r--nova/tests/compute/test_rpcapi.py2
-rw-r--r--nova/tests/conductor/test_conductor.py2
-rw-r--r--nova/tests/console/test_console.py2
-rw-r--r--nova/tests/db/test_db_api.py8
-rw-r--r--nova/tests/db/test_migration_utils.py6
-rw-r--r--nova/tests/image/test_s3.py8
-rw-r--r--nova/tests/integrated/test_servers.py6
-rw-r--r--nova/tests/network/test_linux_net.py4
-rw-r--r--nova/tests/network/test_manager.py20
-rw-r--r--nova/tests/network/test_network_info.py22
-rw-r--r--nova/tests/network/test_neutronv2.py4
-rw-r--r--nova/tests/objects/test_objects.py8
-rw-r--r--nova/tests/servicegroup/test_db_servicegroup.py6
-rw-r--r--nova/tests/servicegroup/test_mc_servicegroup.py6
-rw-r--r--nova/tests/test_block_device.py12
-rw-r--r--nova/tests/test_cinder.py2
-rw-r--r--nova/tests/test_exception.py2
-rw-r--r--nova/tests/test_manager.py2
-rw-r--r--nova/tests/test_metadata.py18
-rw-r--r--nova/tests/test_notifications.py2
-rw-r--r--nova/tests/test_nova_manage.py2
-rw-r--r--nova/tests/test_safeutils.py36
-rw-r--r--nova/tests/test_utils.py26
24 files changed, 151 insertions, 151 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index a16f8c19ee..addd8ce8c3 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -1731,13 +1731,13 @@ class ComputeTestCase(BaseTestCase):
self.assertEquals(payload['instance_type'], 'm1.tiny')
type_id = flavors.get_flavor_by_name('m1.tiny')['id']
self.assertEquals(str(payload['instance_type_id']), str(type_id))
- self.assertTrue('display_name' in payload)
- self.assertTrue('created_at' in payload)
- self.assertTrue('launched_at' in payload)
+ self.assertIn('display_name', payload)
+ self.assertIn('created_at', payload)
+ self.assertIn('launched_at', payload)
image_ref_url = glance.generate_image_url(FAKE_IMAGE_REF)
self.assertEquals(payload['image_ref_url'], image_ref_url)
msg = fake_notifier.NOTIFICATIONS[1]
- self.assertTrue('rescue_image_name' in msg.payload)
+ self.assertIn('rescue_image_name', msg.payload)
self.compute.terminate_instance(self.context, instance=instance)
@@ -1771,9 +1771,9 @@ class ComputeTestCase(BaseTestCase):
self.assertEquals(payload['instance_type'], 'm1.tiny')
type_id = flavors.get_flavor_by_name('m1.tiny')['id']
self.assertEquals(str(payload['instance_type_id']), str(type_id))
- self.assertTrue('display_name' in payload)
- self.assertTrue('created_at' in payload)
- self.assertTrue('launched_at' in payload)
+ self.assertIn('display_name', payload)
+ self.assertIn('created_at', payload)
+ self.assertIn('launched_at', payload)
image_ref_url = glance.generate_image_url(FAKE_IMAGE_REF)
self.assertEquals(payload['image_ref_url'], image_ref_url)
@@ -2812,10 +2812,10 @@ class ComputeTestCase(BaseTestCase):
flavor_id = flavors.get_flavor_by_name('m1.tiny')['flavorid']
self.assertEquals(str(payload['instance_flavor_id']), str(flavor_id))
self.assertEquals(payload['state'], 'active')
- self.assertTrue('display_name' in payload)
- self.assertTrue('created_at' in payload)
- self.assertTrue('launched_at' in payload)
- self.assertTrue('fixed_ips' in payload)
+ self.assertIn('display_name', payload)
+ self.assertIn('created_at', payload)
+ self.assertIn('launched_at', payload)
+ self.assertIn('fixed_ips', payload)
self.assertTrue(payload['launched_at'])
image_ref_url = glance.generate_image_url(FAKE_IMAGE_REF)
self.assertEquals(payload['image_ref_url'], image_ref_url)
@@ -2925,11 +2925,11 @@ class ComputeTestCase(BaseTestCase):
self.assertEquals(str(payload['instance_type_id']), str(type_id))
flavor_id = flavors.get_flavor_by_name('m1.tiny')['flavorid']
self.assertEquals(str(payload['instance_flavor_id']), str(flavor_id))
- self.assertTrue('display_name' in payload)
- self.assertTrue('created_at' in payload)
- self.assertTrue('launched_at' in payload)
- self.assertTrue('terminated_at' in payload)
- self.assertTrue('deleted_at' in payload)
+ self.assertIn('display_name', payload)
+ self.assertIn('created_at', payload)
+ self.assertIn('launched_at', payload)
+ self.assertIn('terminated_at', payload)
+ self.assertIn('deleted_at', payload)
self.assertEqual(payload['terminated_at'], timeutils.strtime(cur_time))
image_ref_url = glance.generate_image_url(FAKE_IMAGE_REF)
self.assertEquals(payload['image_ref_url'], image_ref_url)
@@ -3422,7 +3422,7 @@ class ComputeTestCase(BaseTestCase):
# NOTE(mriedem): make sure prep_resize set old_vm_state correctly
sys_meta = instance.system_metadata
- self.assertTrue('old_vm_state' in sys_meta)
+ self.assertIn('old_vm_state', sys_meta)
if power_on:
self.assertEqual(vm_states.ACTIVE, sys_meta['old_vm_state'])
else:
@@ -3773,9 +3773,9 @@ class ComputeTestCase(BaseTestCase):
self.assertEquals(str(payload['instance_type_id']), str(type_id))
flavor_id = flavors.get_flavor_by_name('m1.tiny')['flavorid']
self.assertEquals(str(payload['instance_flavor_id']), str(flavor_id))
- self.assertTrue('display_name' in payload)
- self.assertTrue('created_at' in payload)
- self.assertTrue('launched_at' in payload)
+ self.assertIn('display_name', payload)
+ self.assertIn('created_at', payload)
+ self.assertIn('launched_at', payload)
self.assertEqual(payload['launched_at'], timeutils.strtime(cur_time))
self.assertEquals(payload['image_ref_url'], new_image_ref_url)
self.compute.terminate_instance(self.context,
@@ -3830,9 +3830,9 @@ class ComputeTestCase(BaseTestCase):
self.assertEquals(payload['instance_type'], 'm1.small')
self.assertEquals(str(payload['instance_type_id']), str(new_type_id))
self.assertEquals(str(payload['instance_flavor_id']), str(flavor_id))
- self.assertTrue('display_name' in payload)
- self.assertTrue('created_at' in payload)
- self.assertTrue('launched_at' in payload)
+ self.assertIn('display_name', payload)
+ self.assertIn('created_at', payload)
+ self.assertIn('launched_at', payload)
self.assertEqual(payload['launched_at'], timeutils.strtime(cur_time))
image_ref_url = glance.generate_image_url(FAKE_IMAGE_REF)
self.assertEquals(payload['image_ref_url'], image_ref_url)
@@ -3880,9 +3880,9 @@ class ComputeTestCase(BaseTestCase):
self.assertEquals(str(payload['instance_type_id']), str(type_id))
flavor_id = flavors.get_flavor_by_name('m1.tiny')['flavorid']
self.assertEquals(str(payload['instance_flavor_id']), str(flavor_id))
- self.assertTrue('display_name' in payload)
- self.assertTrue('created_at' in payload)
- self.assertTrue('launched_at' in payload)
+ self.assertIn('display_name', payload)
+ self.assertIn('created_at', payload)
+ self.assertIn('launched_at', payload)
image_ref_url = glance.generate_image_url(FAKE_IMAGE_REF)
self.assertEquals(payload['image_ref_url'], image_ref_url)
self.compute.terminate_instance(self.context, instance=instance)
@@ -4569,7 +4569,7 @@ class ComputeTestCase(BaseTestCase):
migrate_data = {'is_shared_storage': False}
self.compute._post_live_migration(c, inst_ref, dest,
migrate_data=migrate_data)
- self.assertTrue('destroyed' in result)
+ self.assertIn('destroyed', result)
self.assertTrue(result['destroyed'] == True)
def test_post_live_migration_working_correctly(self):
@@ -4757,7 +4757,7 @@ class ComputeTestCase(BaseTestCase):
exc_info = None
def fake_db_fault_create(ctxt, values):
- self.assertTrue('raise NotImplementedError' in values['details'])
+ self.assertIn('raise NotImplementedError', values['details'])
del values['details']
expected = {
@@ -5991,7 +5991,7 @@ class ComputeAPITestCase(BaseTestCase):
'image_ramdisk_id': 'fake_ramdisk_id',
'image_something_else': 'meow', }
for key, value in image_props.iteritems():
- self.assertTrue(key in sys_metadata)
+ self.assertIn(key, sys_metadata)
self.assertEqual(value, sys_metadata[key])
finally:
@@ -6012,7 +6012,7 @@ class ComputeAPITestCase(BaseTestCase):
'rxtx_factor', 'vcpu_weight']
for key in instance_type_props:
sys_meta_key = "instance_type_%s" % key
- self.assertTrue(sys_meta_key in sys_metadata)
+ self.assertIn(sys_meta_key, sys_metadata)
self.assertEqual(str(instance_type[key]),
str(sys_metadata[sys_meta_key]))
@@ -6587,27 +6587,27 @@ class ComputeAPITestCase(BaseTestCase):
search_opts={'name': '^woo.*'})
self.assertEqual(len(instances), 2)
instance_uuids = [instance['uuid'] for instance in instances]
- self.assertTrue(instance1['uuid'] in instance_uuids)
- self.assertTrue(instance2['uuid'] in instance_uuids)
+ self.assertIn(instance1['uuid'], instance_uuids)
+ self.assertIn(instance2['uuid'], instance_uuids)
instances = self.compute_api.get_all(c,
search_opts={'name': '^woot.*'})
instance_uuids = [instance['uuid'] for instance in instances]
self.assertEqual(len(instances), 1)
- self.assertTrue(instance1['uuid'] in instance_uuids)
+ self.assertIn(instance1['uuid'], instance_uuids)
instances = self.compute_api.get_all(c,
search_opts={'name': '.*oot.*'})
self.assertEqual(len(instances), 2)
instance_uuids = [instance['uuid'] for instance in instances]
- self.assertTrue(instance1['uuid'] in instance_uuids)
- self.assertTrue(instance3['uuid'] in instance_uuids)
+ self.assertIn(instance1['uuid'], instance_uuids)
+ self.assertIn(instance3['uuid'], instance_uuids)
instances = self.compute_api.get_all(c,
search_opts={'name': '^n.*'})
self.assertEqual(len(instances), 1)
instance_uuids = [instance['uuid'] for instance in instances]
- self.assertTrue(instance3['uuid'] in instance_uuids)
+ self.assertIn(instance3['uuid'], instance_uuids)
instances = self.compute_api.get_all(c,
search_opts={'name': 'noth.*'})
@@ -6689,8 +6689,8 @@ class ComputeAPITestCase(BaseTestCase):
instances = self.compute_api.get_all(c, search_opts={'image': '4567'})
self.assertEqual(len(instances), 2)
instance_uuids = [instance['uuid'] for instance in instances]
- self.assertTrue(instance2['uuid'] in instance_uuids)
- self.assertTrue(instance3['uuid'] in instance_uuids)
+ self.assertIn(instance2['uuid'], instance_uuids)
+ self.assertIn(instance3['uuid'], instance_uuids)
# Test passing a list as search arg
instances = self.compute_api.get_all(c,
@@ -6734,8 +6734,8 @@ class ComputeAPITestCase(BaseTestCase):
instances = self.compute_api.get_all(c, search_opts={'flavor': 1})
self.assertEqual(len(instances), 2)
instance_uuids = [instance['uuid'] for instance in instances]
- self.assertTrue(instance2['uuid'] in instance_uuids)
- self.assertTrue(instance3['uuid'] in instance_uuids)
+ self.assertIn(instance2['uuid'], instance_uuids)
+ self.assertIn(instance3['uuid'], instance_uuids)
db.instance_destroy(c, instance1['uuid'])
db.instance_destroy(c, instance2['uuid'])
@@ -6768,8 +6768,8 @@ class ComputeAPITestCase(BaseTestCase):
search_opts={'power_state': power_state.RUNNING})
self.assertEqual(len(instances), 2)
instance_uuids = [instance['uuid'] for instance in instances]
- self.assertTrue(instance2['uuid'] in instance_uuids)
- self.assertTrue(instance3['uuid'] in instance_uuids)
+ self.assertIn(instance2['uuid'], instance_uuids)
+ self.assertIn(instance3['uuid'], instance_uuids)
# Test passing a list as search arg
instances = self.compute_api.get_all(c,
@@ -6821,8 +6821,8 @@ class ComputeAPITestCase(BaseTestCase):
search_opts={'metadata': {'key3': 'value3'}})
self.assertEqual(len(instances), 2)
instance_uuids = [instance['uuid'] for instance in instances]
- self.assertTrue(instance3['uuid'] in instance_uuids)
- self.assertTrue(instance4['uuid'] in instance_uuids)
+ self.assertIn(instance3['uuid'], instance_uuids)
+ self.assertIn(instance4['uuid'], instance_uuids)
# multiple criteria as a dict
instances = self.compute_api.get_all(c,
@@ -6899,7 +6899,7 @@ class ComputeAPITestCase(BaseTestCase):
self.assertEquals(len(fake_notifier.NOTIFICATIONS), 1)
msg = fake_notifier.NOTIFICATIONS[0]
payload = msg.payload
- self.assertTrue('metadata' in payload)
+ self.assertIn('metadata', payload)
self.assertEquals(payload['metadata'], metadata)
new_metadata = {'key2': 'bah', 'key3': 'value3'}
@@ -6916,7 +6916,7 @@ class ComputeAPITestCase(BaseTestCase):
self.assertEquals(len(fake_notifier.NOTIFICATIONS), 2)
msg = fake_notifier.NOTIFICATIONS[1]
payload = msg.payload
- self.assertTrue('metadata' in payload)
+ self.assertIn('metadata', payload)
self.assertEquals(payload['metadata'], metadata)
self.compute_api.delete_instance_metadata(_context, instance, 'key2')
@@ -6927,7 +6927,7 @@ class ComputeAPITestCase(BaseTestCase):
self.assertEquals(len(fake_notifier.NOTIFICATIONS), 3)
msg = fake_notifier.NOTIFICATIONS[2]
payload = msg.payload
- self.assertTrue('metadata' in payload)
+ self.assertIn('metadata', payload)
self.assertEquals(payload['metadata'], {})
db.instance_destroy(_context, instance['uuid'])
@@ -8298,7 +8298,7 @@ class ComputeAPIAggrTestCase(BaseTestCase):
def fake_add_aggregate_host(*args, **kwargs):
hosts = kwargs["aggregate"]["hosts"]
- self.assertTrue(fake_host in hosts)
+ self.assertIn(fake_host, hosts)
self.stubs.Set(self.api.compute_rpcapi, 'add_aggregate_host',
fake_add_aggregate_host)
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index d03fed03ae..f8d5ebb77a 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -40,7 +40,7 @@ class ComputeRpcAPITestCase(test.TestCase):
self.fake_instance = jsonutils.to_primitive(inst)
def test_serialized_instance_has_name(self):
- self.assertTrue('name' in self.fake_instance)
+ self.assertIn('name', self.fake_instance)
def _test_compute_api(self, method, rpc_method, **kwargs):
ctxt = context.RequestContext('fake_user', 'fake_project')
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index cbb1fcbb49..3a6e239bc9 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -1192,7 +1192,7 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase):
self.conductor.wait_until_ready(self.context)
self.assertEqual(timeouts.count(10), 10)
- self.assertTrue(None in timeouts)
+ self.assertIn(None, timeouts)
def test_security_groups_trigger_handler(self):
self.mox.StubOutWithMock(self.conductor_manager.security_group_api,
diff --git a/nova/tests/console/test_console.py b/nova/tests/console/test_console.py
index 209b897253..ecc55d8559 100644
--- a/nova/tests/console/test_console.py
+++ b/nova/tests/console/test_console.py
@@ -100,7 +100,7 @@ class ConsoleTestCase(test.TestCase):
self.console.driver.console_type)
console_instances = [con['instance_uuid'] for con in pool['consoles']]
- self.assertTrue(instance['uuid'] in console_instances)
+ self.assertIn(instance['uuid'], console_instances)
db.instance_destroy(self.context, instance['uuid'])
def test_add_console_does_not_duplicate(self):
diff --git a/nova/tests/db/test_db_api.py b/nova/tests/db/test_db_api.py
index a77f7ba661..1125930e66 100644
--- a/nova/tests/db/test_db_api.py
+++ b/nova/tests/db/test_db_api.py
@@ -370,7 +370,7 @@ class AggregateDBApiTestCase(test.TestCase):
r1 = db.aggregate_metadata_get_by_metadata_key(ctxt, aggr['id'],
'availability_zone')
self.assertEqual(r1['availability_zone'], set(['az1']))
- self.assertTrue('availability_zone' in r1)
+ self.assertIn('availability_zone', r1)
self.assertNotIn('name', r1)
def test_aggregate_metadata_get_by_host_with_key(self):
@@ -1470,7 +1470,7 @@ class InstanceTestCase(test.TestCase, ModelsObjectComparatorMixin):
uuids = [self.create_instance_with_args()['uuid'] for i in range(3)]
meta = sqlalchemy_api._instance_metadata_get_multi(self.ctxt, uuids)
for row in meta:
- self.assertTrue(row['instance_uuid'] in uuids)
+ self.assertIn(row['instance_uuid'], uuids)
def test_instance_metadata_get_multi_no_uuids(self):
self.mox.StubOutWithMock(query.Query, 'filter')
@@ -1482,7 +1482,7 @@ class InstanceTestCase(test.TestCase, ModelsObjectComparatorMixin):
sys_meta = sqlalchemy_api._instance_system_metadata_get_multi(
self.ctxt, uuids)
for row in sys_meta:
- self.assertTrue(row['instance_uuid'] in uuids)
+ self.assertIn(row['instance_uuid'], uuids)
def test_instance_system_metadata_get_multi_no_uuids(self):
self.mox.StubOutWithMock(query.Query, 'filter')
@@ -6006,7 +6006,7 @@ class Ec2TestCase(test.TestCase):
try:
method(self.ctxt, value)
except exception.NotFound as exc:
- self.assertTrue(unicode(value) in unicode(exc))
+ self.assertIn(unicode(value), unicode(exc))
check_exc_format(db.get_ec2_volume_id_by_uuid, 'fake')
check_exc_format(db.get_volume_uuid_by_ec2_id, 123456)
diff --git a/nova/tests/db/test_migration_utils.py b/nova/tests/db/test_migration_utils.py
index 9f311a3cb5..42a4fd7828 100644
--- a/nova/tests/db/test_migration_utils.py
+++ b/nova/tests/db/test_migration_utils.py
@@ -194,7 +194,7 @@ class TestMigrationUtils(test_migrations.BaseMigrationTestCase):
self.assertEqual(len(real_ids), len(expected_ids))
for id_ in expected_ids:
- self.assertTrue(id_ in real_ids)
+ self.assertIn(id_, real_ids)
def test_drop_old_duplicate_entries_from_table_soft_delete(self):
table_name = "__test_tmp_table__"
@@ -227,7 +227,7 @@ class TestMigrationUtils(test_migrations.BaseMigrationTestCase):
engine.execute(rows_select).fetchall()]
self.assertEqual(len(row_ids), len(expected_values))
for value in expected_values:
- self.assertTrue(value['id'] in row_ids)
+ self.assertIn(value['id'], row_ids)
deleted_rows_select = base_select.\
where(table.c.deleted == table.c.id)
@@ -236,7 +236,7 @@ class TestMigrationUtils(test_migrations.BaseMigrationTestCase):
self.assertEqual(len(deleted_rows_ids),
len(values) - len(row_ids))
for value in soft_deleted_values:
- self.assertTrue(value['id'] in deleted_rows_ids)
+ self.assertIn(value['id'], deleted_rows_ids)
def test_check_shadow_table(self):
table_name = 'abc'
diff --git a/nova/tests/image/test_s3.py b/nova/tests/image/test_s3.py
index 27314c0453..1fc64fb3eb 100644
--- a/nova/tests/image/test_s3.py
+++ b/nova/tests/image/test_s3.py
@@ -109,9 +109,9 @@ class TestS3ImageService(test.TestCase):
key = keys[0]
for x in list0:
self.assertEqual(len(x), len(keys))
- self.assertTrue(key in x)
+ self.assertIn(key, x)
for y in list1:
- self.assertTrue(key in y)
+ self.assertIn(key, y)
if x[key] == y[key]:
for k in keys:
self.assertEqual(x[k], y[k])
@@ -172,10 +172,10 @@ class TestS3ImageService(test.TestCase):
self.context, metadata, ami_manifest_xml)
ret_image = self.image_service.show(self.context, image['id'])
- self.assertTrue('properties' in ret_image)
+ self.assertIn('properties', ret_image)
properties = ret_image['properties']
- self.assertTrue('mappings' in properties)
+ self.assertIn('mappings', properties)
mappings = properties['mappings']
expected_mappings = [
{"device": "sda1", "virtual": "ami"},
diff --git a/nova/tests/integrated/test_servers.py b/nova/tests/integrated/test_servers.py
index cab0212a09..c90a3acfea 100644
--- a/nova/tests/integrated/test_servers.py
+++ b/nova/tests/integrated/test_servers.py
@@ -141,7 +141,7 @@ class ServersTest(integrated_helpers._IntegratedTestBase):
# It should also be in the all-servers list
servers = self.api.get_servers()
server_ids = [s['id'] for s in servers]
- self.assertTrue(created_server_id in server_ids)
+ self.assertIn(created_server_id, server_ids)
found_server = self._wait_for_state_change(found_server, 'BUILD')
# It should be available...
@@ -149,8 +149,8 @@ class ServersTest(integrated_helpers._IntegratedTestBase):
self.assertEqual('ACTIVE', found_server['status'])
servers = self.api.get_servers(detail=True)
for server in servers:
- self.assertTrue("image" in server)
- self.assertTrue("flavor" in server)
+ self.assertIn("image", server)
+ self.assertIn("flavor", server)
self._delete_server(created_server_id)
diff --git a/nova/tests/network/test_linux_net.py b/nova/tests/network/test_linux_net.py
index 81b333fe08..dc641c32ba 100644
--- a/nova/tests/network/test_linux_net.py
+++ b/nova/tests/network/test_linux_net.py
@@ -636,7 +636,7 @@ class LinuxNetworkTestCase(test.NoDBTestCase):
'-s 192.168.1.1 -j DROP' % iface,
]
for inp in expected_inputs:
- self.assertTrue(inp in inputs[0])
+ self.assertIn(inp, inputs[0])
executes = []
inputs = []
@@ -727,7 +727,7 @@ class LinuxNetworkTestCase(test.NoDBTestCase):
'-s 192.168.1.1 -j LOGDROP' % iface),
]
for inp in expected_inputs:
- self.assertTrue(inp in inputs[0])
+ self.assertIn(inp, inputs[0])
executes = []
inputs = []
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py
index d3d1314a75..6ff897eefe 100644
--- a/nova/tests/network/test_manager.py
+++ b/nova/tests/network/test_manager.py
@@ -1430,7 +1430,7 @@ class CommonNetworkTestCase(test.TestCase):
None, None)
self.assertEqual(1, len(nets))
cidrs = [str(net['cidr']) for net in nets]
- self.assertTrue('192.168.0.0/24' in cidrs)
+ self.assertIn('192.168.0.0/24', cidrs)
def test_validate_cidrs_split_exact_in_half(self):
manager = fake_network.FakeNetworkManager()
@@ -1439,8 +1439,8 @@ class CommonNetworkTestCase(test.TestCase):
None, None)
self.assertEqual(2, len(nets))
cidrs = [str(net['cidr']) for net in nets]
- self.assertTrue('192.168.0.0/25' in cidrs)
- self.assertTrue('192.168.0.128/25' in cidrs)
+ self.assertIn('192.168.0.0/25', cidrs)
+ self.assertIn('192.168.0.128/25', cidrs)
def test_validate_cidrs_split_cidr_in_use_middle_of_range(self):
manager = fake_network.FakeNetworkManager()
@@ -1457,7 +1457,7 @@ class CommonNetworkTestCase(test.TestCase):
exp_cidrs = ['192.168.0.0/24', '192.168.1.0/24', '192.168.3.0/24',
'192.168.4.0/24']
for exp_cidr in exp_cidrs:
- self.assertTrue(exp_cidr in cidrs)
+ self.assertIn(exp_cidr, cidrs)
self.assertNotIn('192.168.2.0/24', cidrs)
def test_validate_cidrs_smaller_subnet_in_use(self):
@@ -1489,7 +1489,7 @@ class CommonNetworkTestCase(test.TestCase):
exp_cidrs = ['192.168.0.0/24', '192.168.1.0/24', '192.168.3.0/24',
'192.168.4.0/24']
for exp_cidr in exp_cidrs:
- self.assertTrue(exp_cidr in cidrs)
+ self.assertIn(exp_cidr, cidrs)
self.assertNotIn('192.168.2.0/24', cidrs)
def test_validate_cidrs_split_smaller_cidr_in_use2(self):
@@ -1506,7 +1506,7 @@ class CommonNetworkTestCase(test.TestCase):
cidrs = [str(net['cidr']) for net in nets]
exp_cidrs = ['192.168.2.32/27', '192.168.2.64/27', '192.168.2.96/27']
for exp_cidr in exp_cidrs:
- self.assertTrue(exp_cidr in cidrs)
+ self.assertIn(exp_cidr, cidrs)
self.assertNotIn('192.168.2.0/27', cidrs)
def test_validate_cidrs_split_all_in_use(self):
@@ -1560,8 +1560,8 @@ class CommonNetworkTestCase(test.TestCase):
False, 2, 256, None, None, None, None,
None)
returned_cidrs = [str(net['cidr']) for net in nets]
- self.assertTrue('192.168.0.0/24' in returned_cidrs)
- self.assertTrue('192.168.1.0/24' in returned_cidrs)
+ self.assertIn('192.168.0.0/24', returned_cidrs)
+ self.assertIn('192.168.1.0/24', returned_cidrs)
def test_validate_cidrs_conflict_existing_supernet(self):
manager = fake_network.FakeNetworkManager()
@@ -1853,7 +1853,7 @@ class CommonNetworkTestCase(test.TestCase):
# Compare the expected rules against the actual ones
for line in expected_lines:
- self.assertTrue(line in new_lines)
+ self.assertIn(line, new_lines)
# Add an additional network and ensure the rules get configured
new_network = {'id': 2,
@@ -1907,7 +1907,7 @@ class CommonNetworkTestCase(test.TestCase):
# Compare the expected rules (with new network) against the actual ones
for line in expected_lines:
- self.assertTrue(line in new_lines)
+ self.assertIn(line, new_lines)
def test_flatdhcpmanager_dynamic_fixed_range(self):
"""Test FlatDHCPManager NAT rules for fixed_range."""
diff --git a/nova/tests/network/test_network_info.py b/nova/tests/network/test_network_info.py
index 4ff24f9aa3..e2f1a5647f 100644
--- a/nova/tests/network/test_network_info.py
+++ b/nova/tests/network/test_network_info.py
@@ -422,22 +422,22 @@ class NetworkInfoTests(test.NoDBTestCase):
self.assertTrue(template is None)
else:
if use_ipv4:
- self.assertTrue('auto eth0' in template)
- self.assertTrue('iface eth0 inet static' in template)
- self.assertTrue('address 10.10.0.2' in template)
- self.assertTrue('netmask 255.255.255.0' in template)
- self.assertTrue('broadcast 10.10.0.255' in template)
+ self.assertIn('auto eth0', template)
+ self.assertIn('iface eth0 inet static', template)
+ self.assertIn('address 10.10.0.2', template)
+ self.assertIn('netmask 255.255.255.0', template)
+ self.assertIn('broadcast 10.10.0.255', template)
if gateway:
- self.assertTrue('gateway 10.10.0.1' in template)
+ self.assertIn('gateway 10.10.0.1', template)
else:
self.assertNotIn('gateway', template)
- self.assertTrue('dns-nameservers 1.2.3.4 2.3.4.5' in template)
+ self.assertIn('dns-nameservers 1.2.3.4 2.3.4.5', template)
if use_ipv6:
- self.assertTrue('iface eth0 inet6 static' in template)
- self.assertTrue('address 1234:567::2' in template)
- self.assertTrue('netmask 48' in template)
+ self.assertIn('iface eth0 inet6 static', template)
+ self.assertIn('address 1234:567::2', template)
+ self.assertIn('netmask 48', template)
if gateway:
- self.assertTrue('gateway 1234:567::1' in template)
+ self.assertIn('gateway 1234:567::1', template)
if not use_ipv4 and not use_ipv6:
self.assertTrue(template is None)
diff --git a/nova/tests/network/test_neutronv2.py b/nova/tests/network/test_neutronv2.py
index 52652d7b28..f52cd923f3 100644
--- a/nova/tests/network/test_neutronv2.py
+++ b/nova/tests/network/test_neutronv2.py
@@ -907,7 +907,7 @@ class TestNeutronv2(TestNeutronv2Base):
try:
api.validate_networks(self.context, requested_networks)
except exception.NetworkNotFound as ex:
- self.assertTrue("my_netid2" in str(ex))
+ self.assertIn("my_netid2", str(ex))
def test_validate_networks_ex_2(self):
requested_networks = [('my_netid1', 'test', None),
@@ -922,7 +922,7 @@ class TestNeutronv2(TestNeutronv2Base):
try:
api.validate_networks(self.context, requested_networks)
except exception.NetworkNotFound as ex:
- self.assertTrue("my_netid2, my_netid3" in str(ex))
+ self.assertIn("my_netid2, my_netid3", str(ex))
def test_validate_networks_duplicate(self):
"""Verify that the correct exception is thrown when duplicate
diff --git a/nova/tests/objects/test_objects.py b/nova/tests/objects/test_objects.py
index 830ce1c2ca..8cdcd8d9dc 100644
--- a/nova/tests/objects/test_objects.py
+++ b/nova/tests/objects/test_objects.py
@@ -453,7 +453,7 @@ class _TestObject(object):
except NotImplementedError as ex:
raised = True
self.assertTrue(raised)
- self.assertTrue('foobar' in str(ex))
+ self.assertIn('foobar', str(ex))
def test_loaded_in_primitive(self):
obj = MyObj(foo=1)
@@ -471,7 +471,7 @@ class _TestObject(object):
obj = MyObj(foo=123)
self.assertEqual(obj.obj_what_changed(), set(['foo']))
primitive = obj.obj_to_primitive()
- self.assertTrue('nova_object.changes' in primitive)
+ self.assertIn('nova_object.changes', primitive)
obj2 = MyObj.obj_from_primitive(primitive)
self.assertEqual(obj2.obj_what_changed(), set(['foo']))
obj2.obj_reset_changes()
@@ -570,7 +570,7 @@ class _TestObject(object):
obj = MyObj()
self.assertNotIn('foo', obj)
obj.foo = 1
- self.assertTrue('foo' in obj)
+ self.assertIn('foo', obj)
self.assertNotIn('does_not_exist', obj)
def test_obj_attr_is_set(self):
@@ -715,7 +715,7 @@ class TestObjectSerializer(_BaseTestCase):
ser = base.NovaObjectSerializer()
obj = MyObj()
primitive = ser.serialize_entity(self.context, obj)
- self.assertTrue('nova_object.name' in primitive)
+ self.assertIn('nova_object.name', primitive)
obj2 = ser.deserialize_entity(self.context, primitive)
self.assertIsInstance(obj2, MyObj)
self.assertEqual(self.context, obj2._context)
diff --git a/nova/tests/servicegroup/test_db_servicegroup.py b/nova/tests/servicegroup/test_db_servicegroup.py
index 43b6c5d112..5d1755e883 100644
--- a/nova/tests/servicegroup/test_db_servicegroup.py
+++ b/nova/tests/servicegroup/test_db_servicegroup.py
@@ -103,11 +103,11 @@ class DBServiceGroupTestCase(test.TestCase):
services = self.servicegroup_api.get_all(self._topic)
- self.assertTrue(service_ref1['host'] in services)
- self.assertTrue(service_ref2['host'] in services)
+ self.assertIn(service_ref1['host'], services)
+ self.assertIn(service_ref2['host'], services)
service_id = self.servicegroup_api.get_one(self._topic)
- self.assertTrue(service_id in services)
+ self.assertIn(service_id, services)
def test_service_is_up(self):
fts_func = datetime.datetime.fromtimestamp
diff --git a/nova/tests/servicegroup/test_mc_servicegroup.py b/nova/tests/servicegroup/test_mc_servicegroup.py
index 88c63eb2f0..ca966cfd4f 100644
--- a/nova/tests/servicegroup/test_mc_servicegroup.py
+++ b/nova/tests/servicegroup/test_mc_servicegroup.py
@@ -123,12 +123,12 @@ class MemcachedServiceGroupTestCase(test.TestCase):
services = self.servicegroup_api.get_all(self._topic)
- self.assertTrue(host1 in services)
- self.assertTrue(host2 in services)
+ self.assertIn(host1, services)
+ self.assertIn(host2, services)
self.assertNotIn(host3, services)
service_id = self.servicegroup_api.get_one(self._topic)
- self.assertTrue(service_id in services)
+ self.assertIn(service_id, services)
def test_service_is_up(self):
serv = self.useFixture(
diff --git a/nova/tests/test_block_device.py b/nova/tests/test_block_device.py
index 0a38eaf201..710311fed8 100644
--- a/nova/tests/test_block_device.py
+++ b/nova/tests/test_block_device.py
@@ -277,15 +277,15 @@ class TestBlockDeviceDict(test.NoDBTestCase):
dev_dict = block_device.BlockDeviceDict({'field1': 'foo',
'field2': 'bar',
'db_field1': 'baz'})
- self.assertTrue('field1' in dev_dict)
- self.assertTrue('field2' in dev_dict)
- self.assertTrue('db_field1' in dev_dict)
+ self.assertIn('field1', dev_dict)
+ self.assertIn('field2', dev_dict)
+ self.assertIn('db_field1', dev_dict)
self.assertFalse('db_field2'in dev_dict)
# Make sure all expected fields are defaulted
dev_dict = block_device.BlockDeviceDict({'field1': 'foo'})
- self.assertTrue('field1' in dev_dict)
- self.assertTrue('field2' in dev_dict)
+ self.assertIn('field1', dev_dict)
+ self.assertIn('field2', dev_dict)
self.assertTrue(dev_dict['field2'] is None)
self.assertNotIn('db_field1', dev_dict)
self.assertFalse('db_field2'in dev_dict)
@@ -293,7 +293,7 @@ class TestBlockDeviceDict(test.NoDBTestCase):
# Unless they are not meant to be
dev_dict = block_device.BlockDeviceDict({'field1': 'foo'},
do_not_default=set(['field2']))
- self.assertTrue('field1' in dev_dict)
+ self.assertIn('field1', dev_dict)
self.assertNotIn('field2', dev_dict)
self.assertNotIn('db_field1', dev_dict)
self.assertFalse('db_field2'in dev_dict)
diff --git a/nova/tests/test_cinder.py b/nova/tests/test_cinder.py
index 1e71a099ca..ae1382c69e 100644
--- a/nova/tests/test_cinder.py
+++ b/nova/tests/test_cinder.py
@@ -176,7 +176,7 @@ class CinderTestCase(test.NoDBTestCase):
def test_volume_with_image_metadata(self):
volume = self.api.get(self.context, '5678')
self.assert_called('GET', '/volumes/5678')
- self.assertTrue('volume_image_metadata' in volume)
+ self.assertIn('volume_image_metadata', volume)
self.assertEqual(volume['volume_image_metadata'], _image_metadata)
def test_cinder_api_insecure(self):
diff --git a/nova/tests/test_exception.py b/nova/tests/test_exception.py
index 29107786ac..b3d418ae76 100644
--- a/nova/tests/test_exception.py
+++ b/nova/tests/test_exception.py
@@ -61,7 +61,7 @@ class WrapExceptionTestCase(test.NoDBTestCase):
self.assertEquals(notifier.provided_context, ctxt)
self.assertEquals(notifier.provided_payload['args']['extra'], 3)
for key in ['exception', 'args']:
- self.assertTrue(key in notifier.provided_payload.keys())
+ self.assertIn(key, notifier.provided_payload.keys())
class NovaExceptionTestCase(test.NoDBTestCase):
diff --git a/nova/tests/test_manager.py b/nova/tests/test_manager.py
index 827c48979d..a51d9406ec 100644
--- a/nova/tests/test_manager.py
+++ b/nova/tests/test_manager.py
@@ -32,4 +32,4 @@ class ManagerTestCase(test.NoDBTestCase):
dispatch = m.create_rpc_dispatcher(additional_apis=[api])
self.assertEqual(len(dispatch.callbacks), 3)
- self.assertTrue(api in dispatch.callbacks)
+ self.assertIn(api, dispatch.callbacks)
diff --git a/nova/tests/test_metadata.py b/nova/tests/test_metadata.py
index 93d3ddb02c..6c1b5b4e7a 100644
--- a/nova/tests/test_metadata.py
+++ b/nova/tests/test_metadata.py
@@ -353,8 +353,8 @@ class OpenStackMetadataTestCase(test.TestCase):
# the 'content' should not show up in directory listing
self.assertNotIn(base.CONTENT_DIR, result)
- self.assertTrue('2012-08-10' in result)
- self.assertTrue('latest' in result)
+ self.assertIn('2012-08-10', result)
+ self.assertIn('latest', result)
def test_version_content_listing(self):
# request for /openstack/<version>/ should show metadata.json
@@ -362,7 +362,7 @@ class OpenStackMetadataTestCase(test.TestCase):
mdinst = fake_InstanceMetadata(self.stubs, inst)
listing = mdinst.lookup("/openstack/2012-08-10")
- self.assertTrue("meta_data.json" in listing)
+ self.assertIn("meta_data.json", listing)
def test_metadata_json(self):
inst = copy.copy(self.instance)
@@ -379,13 +379,13 @@ class OpenStackMetadataTestCase(test.TestCase):
mddict = json.loads(mdjson)
self.assertEqual(mddict['uuid'], self.instance['uuid'])
- self.assertTrue('files' in mddict)
+ self.assertIn('files', mddict)
- self.assertTrue('public_keys' in mddict)
+ self.assertIn('public_keys', mddict)
self.assertEqual(mddict['public_keys'][self.instance['key_name']],
self.instance['key_data'])
- self.assertTrue('launch_index' in mddict)
+ self.assertIn('launch_index', mddict)
self.assertEqual(mddict['launch_index'], self.instance['launch_index'])
# verify that each of the things we put in content
@@ -427,7 +427,7 @@ class OpenStackMetadataTestCase(test.TestCase):
self.assertEqual(USER_DATA_STRING, userdata_found)
# since we had user-data in this instance, it should be in listing
- self.assertTrue('user_data' in mdinst.lookup("/openstack/2012-08-10"))
+ self.assertIn('user_data', mdinst.lookup("/openstack/2012-08-10"))
del inst['user_data']
mdinst = fake_InstanceMetadata(self.stubs, inst)
@@ -446,7 +446,7 @@ class OpenStackMetadataTestCase(test.TestCase):
mdjson = mdinst.lookup("/openstack/2013-04-04/meta_data.json")
mddict = json.loads(mdjson)
- self.assertTrue("random_seed" in mddict)
+ self.assertIn("random_seed", mddict)
self.assertEqual(len(base64.b64decode(mddict["random_seed"])), 512)
# verify that older version do not have it
@@ -467,7 +467,7 @@ class OpenStackMetadataTestCase(test.TestCase):
# verify that 2013-10-17 has the vendor_data.json file
result = mdinst.lookup("/openstack/2013-10-17")
- self.assertTrue('vendor_data.json' in result)
+ self.assertIn('vendor_data.json', result)
# verify that older version do not have it
result = mdinst.lookup("/openstack/2013-04-04")
diff --git a/nova/tests/test_notifications.py b/nova/tests/test_notifications.py
index f80b45b100..61563d6f9c 100644
--- a/nova/tests/test_notifications.py
+++ b/nova/tests/test_notifications.py
@@ -277,7 +277,7 @@ class NotificationsTestCase(test.TestCase):
def test_payload_has_fixed_ip_labels(self):
info = notifications.info_from_instance(self.context, self.instance,
self.net_info, None)
- self.assertTrue("fixed_ips" in info)
+ self.assertIn("fixed_ips", info)
self.assertEquals(info["fixed_ips"][0]["label"], "test1")
def test_send_access_ip_update(self):
diff --git a/nova/tests/test_nova_manage.py b/nova/tests/test_nova_manage.py
index 20e48d6727..a7f9b2c099 100644
--- a/nova/tests/test_nova_manage.py
+++ b/nova/tests/test_nova_manage.py
@@ -80,7 +80,7 @@ class FloatingIpCommandsTestCase(test.TestCase):
def test_address_to_hosts(self):
def assert_loop(result, expected):
for ip in result:
- self.assertTrue(str(ip) in expected)
+ self.assertIn(str(ip), expected)
address_to_hosts = self.commands.address_to_hosts
# /32 and /31
diff --git a/nova/tests/test_safeutils.py b/nova/tests/test_safeutils.py
index 8891aaa19d..770f3be81a 100644
--- a/nova/tests/test_safeutils.py
+++ b/nova/tests/test_safeutils.py
@@ -28,11 +28,11 @@ class GetCallArgsTestCase(test.NoDBTestCase):
callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs)
#implicit self counts as an arg
self.assertEqual(4, len(callargs))
- self.assertTrue('instance' in callargs)
+ self.assertIn('instance', callargs)
self.assertEqual({'uuid': 1}, callargs['instance'])
- self.assertTrue('red' in callargs)
+ self.assertIn('red', callargs)
self.assertEqual(3, callargs['red'])
- self.assertTrue('blue' in callargs)
+ self.assertIn('blue', callargs)
self.assertEqual(4, callargs['blue'])
def test_all_args(self):
@@ -41,11 +41,11 @@ class GetCallArgsTestCase(test.NoDBTestCase):
callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs)
#implicit self counts as an arg
self.assertEqual(4, len(callargs))
- self.assertTrue('instance' in callargs)
+ self.assertIn('instance', callargs)
self.assertEqual({'uuid': 1}, callargs['instance'])
- self.assertTrue('red' in callargs)
+ self.assertIn('red', callargs)
self.assertEqual(3, callargs['red'])
- self.assertTrue('blue' in callargs)
+ self.assertIn('blue', callargs)
self.assertEqual(4, callargs['blue'])
def test_mixed_args(self):
@@ -54,11 +54,11 @@ class GetCallArgsTestCase(test.NoDBTestCase):
callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs)
#implicit self counts as an arg
self.assertEqual(4, len(callargs))
- self.assertTrue('instance' in callargs)
+ self.assertIn('instance', callargs)
self.assertEqual({'uuid': 1}, callargs['instance'])
- self.assertTrue('red' in callargs)
+ self.assertIn('red', callargs)
self.assertEqual(3, callargs['red'])
- self.assertTrue('blue' in callargs)
+ self.assertIn('blue', callargs)
self.assertEqual(4, callargs['blue'])
def test_partial_kwargs(self):
@@ -67,11 +67,11 @@ class GetCallArgsTestCase(test.NoDBTestCase):
callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs)
#implicit self counts as an arg
self.assertEqual(4, len(callargs))
- self.assertTrue('instance' in callargs)
+ self.assertIn('instance', callargs)
self.assertEqual({'uuid': 1}, callargs['instance'])
- self.assertTrue('red' in callargs)
+ self.assertIn('red', callargs)
self.assertEqual(3, callargs['red'])
- self.assertTrue('blue' in callargs)
+ self.assertIn('blue', callargs)
self.assertEqual(None, callargs['blue'])
def test_partial_args(self):
@@ -80,11 +80,11 @@ class GetCallArgsTestCase(test.NoDBTestCase):
callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs)
#implicit self counts as an arg
self.assertEqual(4, len(callargs))
- self.assertTrue('instance' in callargs)
+ self.assertIn('instance', callargs)
self.assertEqual({'uuid': 1}, callargs['instance'])
- self.assertTrue('red' in callargs)
+ self.assertIn('red', callargs)
self.assertEqual(3, callargs['red'])
- self.assertTrue('blue' in callargs)
+ self.assertIn('blue', callargs)
self.assertEqual(None, callargs['blue'])
def test_partial_mixed_args(self):
@@ -92,9 +92,9 @@ class GetCallArgsTestCase(test.NoDBTestCase):
kwargs = {'instance': {'uuid': 1}}
callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs)
self.assertEqual(4, len(callargs))
- self.assertTrue('instance' in callargs)
+ self.assertIn('instance', callargs)
self.assertEqual({'uuid': 1}, callargs['instance'])
- self.assertTrue('red' in callargs)
+ self.assertIn('red', callargs)
self.assertEqual(3, callargs['red'])
- self.assertTrue('blue' in callargs)
+ self.assertIn('blue', callargs)
self.assertEqual(None, callargs['blue'])
diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py
index dc2dba4819..9f935a5e93 100644
--- a/nova/tests/test_utils.py
+++ b/nova/tests/test_utils.py
@@ -681,10 +681,10 @@ class WrappedCodeTestCase(test.NoDBTestCase):
func = utils.get_wrapped_function(wrapped)
func_code = func.func_code
self.assertEqual(4, len(func_code.co_varnames))
- self.assertTrue('self' in func_code.co_varnames)
- self.assertTrue('instance' in func_code.co_varnames)
- self.assertTrue('red' in func_code.co_varnames)
- self.assertTrue('blue' in func_code.co_varnames)
+ self.assertIn('self', func_code.co_varnames)
+ self.assertIn('instance', func_code.co_varnames)
+ self.assertIn('red', func_code.co_varnames)
+ self.assertIn('blue', func_code.co_varnames)
def test_double_wrapped(self):
@self._wrapper
@@ -695,10 +695,10 @@ class WrappedCodeTestCase(test.NoDBTestCase):
func = utils.get_wrapped_function(wrapped)
func_code = func.func_code
self.assertEqual(4, len(func_code.co_varnames))
- self.assertTrue('self' in func_code.co_varnames)
- self.assertTrue('instance' in func_code.co_varnames)
- self.assertTrue('red' in func_code.co_varnames)
- self.assertTrue('blue' in func_code.co_varnames)
+ self.assertIn('self', func_code.co_varnames)
+ self.assertIn('instance', func_code.co_varnames)
+ self.assertIn('red', func_code.co_varnames)
+ self.assertIn('blue', func_code.co_varnames)
def test_triple_wrapped(self):
@self._wrapper
@@ -710,10 +710,10 @@ class WrappedCodeTestCase(test.NoDBTestCase):
func = utils.get_wrapped_function(wrapped)
func_code = func.func_code
self.assertEqual(4, len(func_code.co_varnames))
- self.assertTrue('self' in func_code.co_varnames)
- self.assertTrue('instance' in func_code.co_varnames)
- self.assertTrue('red' in func_code.co_varnames)
- self.assertTrue('blue' in func_code.co_varnames)
+ self.assertIn('self', func_code.co_varnames)
+ self.assertIn('instance', func_code.co_varnames)
+ self.assertIn('red', func_code.co_varnames)
+ self.assertIn('blue', func_code.co_varnames)
class StringLengthTestCase(test.NoDBTestCase):
@@ -891,7 +891,7 @@ class GetImageFromSystemMetadataTestCase(test.NoDBTestCase):
self.assertEqual(image[key], sys_meta.get(sys_key))
# Verify that we inherit the rest of metadata as properties
- self.assertTrue("properties" in image)
+ self.assertIn("properties", image)
for key, value in image["properties"].iteritems():
sys_key = "%s%s" % (utils.SM_IMAGE_PROP_PREFIX, key)