Merge "Change deprecated assertEquals to assertEqual"
This commit is contained in:
commit
79d87718d9
@ -66,14 +66,14 @@ class TestClusterTemplate(base.BaseFunctionalTestCase):
|
||||
self.ct = self.demo_cloud.create_cluster_template(
|
||||
name=name, image_id=image_id,
|
||||
keypair_id=keypair_id, coe=coe)
|
||||
self.assertEquals(self.ct['name'], name)
|
||||
self.assertEquals(self.ct['image_id'], image_id)
|
||||
self.assertEquals(self.ct['keypair_id'], keypair_id)
|
||||
self.assertEquals(self.ct['coe'], coe)
|
||||
self.assertEquals(self.ct['registry_enabled'], registry_enabled)
|
||||
self.assertEquals(self.ct['tls_disabled'], tls_disabled)
|
||||
self.assertEquals(self.ct['public'], public)
|
||||
self.assertEquals(self.ct['server_type'], server_type)
|
||||
self.assertEqual(self.ct['name'], name)
|
||||
self.assertEqual(self.ct['image_id'], image_id)
|
||||
self.assertEqual(self.ct['keypair_id'], keypair_id)
|
||||
self.assertEqual(self.ct['coe'], coe)
|
||||
self.assertEqual(self.ct['registry_enabled'], registry_enabled)
|
||||
self.assertEqual(self.ct['tls_disabled'], tls_disabled)
|
||||
self.assertEqual(self.ct['public'], public)
|
||||
self.assertEqual(self.ct['server_type'], server_type)
|
||||
|
||||
# Test that we can list cluster_templates
|
||||
cluster_templates = self.demo_cloud.list_cluster_templates()
|
||||
@ -83,19 +83,19 @@ class TestClusterTemplate(base.BaseFunctionalTestCase):
|
||||
# get_cluster_template method
|
||||
cluster_template_get = self.demo_cloud.get_cluster_template(
|
||||
self.ct['uuid'])
|
||||
self.assertEquals(cluster_template_get['uuid'], self.ct['uuid'])
|
||||
self.assertEqual(cluster_template_get['uuid'], self.ct['uuid'])
|
||||
|
||||
# Test the get method also works by name
|
||||
cluster_template_get = self.demo_cloud.get_cluster_template(name)
|
||||
self.assertEquals(cluster_template_get['name'], self.ct['name'])
|
||||
self.assertEqual(cluster_template_get['name'], self.ct['name'])
|
||||
|
||||
# Test we can update a field on the cluster_template and only that
|
||||
# field is updated
|
||||
cluster_template_update = self.demo_cloud.update_cluster_template(
|
||||
self.ct['uuid'], 'replace', tls_disabled=True)
|
||||
self.assertEquals(cluster_template_update['uuid'],
|
||||
self.ct['uuid'])
|
||||
self.assertEquals(cluster_template_update['tls_disabled'], True)
|
||||
self.assertEqual(
|
||||
cluster_template_update['uuid'], self.ct['uuid'])
|
||||
self.assertEqual(cluster_template_update['tls_disabled'], True)
|
||||
|
||||
# Test we can delete and get True returned
|
||||
cluster_template_delete = self.demo_cloud.delete_cluster_template(
|
||||
|
@ -151,7 +151,7 @@ class TestCompute(base.BaseFunctionalTestCase):
|
||||
# We can either get None (if the volume delete was quick), or a volume
|
||||
# that is in the process of being deleted.
|
||||
if volume:
|
||||
self.assertEquals('deleting', volume.status)
|
||||
self.assertEqual('deleting', volume.status)
|
||||
self.assertIsNone(self.demo_cloud.get_server(self.server_name))
|
||||
|
||||
def test_create_boot_from_volume_preexisting(self):
|
||||
@ -201,7 +201,7 @@ class TestCompute(base.BaseFunctionalTestCase):
|
||||
# We can either get None (if the volume delete was quick), or a volume
|
||||
# that is in the process of being deleted.
|
||||
if volume:
|
||||
self.assertEquals('deleting', volume.status)
|
||||
self.assertEqual('deleting', volume.status)
|
||||
self.assertIsNone(self.demo_cloud.get_server(self.server_name))
|
||||
|
||||
def test_create_image_snapshot_wait_active(self):
|
||||
|
@ -50,9 +50,9 @@ class TestInventory(base.BaseFunctionalTestCase):
|
||||
self.nova.servers.delete(i)
|
||||
|
||||
def _test_host_content(self, host):
|
||||
self.assertEquals(host['image']['id'], self.image.id)
|
||||
self.assertEqual(host['image']['id'], self.image.id)
|
||||
self.assertNotIn('links', host['image'])
|
||||
self.assertEquals(host['flavor']['id'], self.flavor.id)
|
||||
self.assertEqual(host['flavor']['id'], self.flavor.id)
|
||||
self.assertNotIn('links', host['flavor'])
|
||||
self.assertNotIn('links', host)
|
||||
self.assertIsInstance(host['volumes'], list)
|
||||
@ -60,13 +60,13 @@ class TestInventory(base.BaseFunctionalTestCase):
|
||||
self.assertIn('interface_ip', host)
|
||||
|
||||
def _test_expanded_host_content(self, host):
|
||||
self.assertEquals(host['image']['name'], self.image.name)
|
||||
self.assertEquals(host['flavor']['name'], self.flavor.name)
|
||||
self.assertEqual(host['image']['name'], self.image.name)
|
||||
self.assertEqual(host['flavor']['name'], self.flavor.name)
|
||||
|
||||
def test_get_host(self):
|
||||
host = self.inventory.get_host(self.server_name)
|
||||
self.assertIsNotNone(host)
|
||||
self.assertEquals(host['name'], self.server_name)
|
||||
self.assertEqual(host['name'], self.server_name)
|
||||
self._test_host_content(host)
|
||||
self._test_expanded_host_content(host)
|
||||
host_found = False
|
||||
@ -79,12 +79,12 @@ class TestInventory(base.BaseFunctionalTestCase):
|
||||
def test_get_host_no_detail(self):
|
||||
host = self.inventory.get_host(self.server_name, expand=False)
|
||||
self.assertIsNotNone(host)
|
||||
self.assertEquals(host['name'], self.server_name)
|
||||
self.assertEqual(host['name'], self.server_name)
|
||||
|
||||
self.assertEquals(host['image']['id'], self.image.id)
|
||||
self.assertEqual(host['image']['id'], self.image.id)
|
||||
self.assertNotIn('links', host['image'])
|
||||
self.assertNotIn('name', host['name'])
|
||||
self.assertEquals(host['flavor']['id'], self.flavor.id)
|
||||
self.assertEqual(host['flavor']['id'], self.flavor.id)
|
||||
self.assertNotIn('links', host['flavor'])
|
||||
self.assertNotIn('name', host['flavor'])
|
||||
|
||||
|
@ -52,12 +52,12 @@ class TestRecordset(base.BaseFunctionalTestCase):
|
||||
created_recordset = self.demo_cloud.create_recordset(zone, name, type_,
|
||||
records,
|
||||
description, ttl)
|
||||
self.assertEquals(created_recordset['zone_id'], zone_obj['id'])
|
||||
self.assertEquals(created_recordset['name'], name + '.' + zone)
|
||||
self.assertEquals(created_recordset['type'], type_.upper())
|
||||
self.assertEquals(created_recordset['records'], records)
|
||||
self.assertEquals(created_recordset['description'], description)
|
||||
self.assertEquals(created_recordset['ttl'], ttl)
|
||||
self.assertEqual(created_recordset['zone_id'], zone_obj['id'])
|
||||
self.assertEqual(created_recordset['name'], name + '.' + zone)
|
||||
self.assertEqual(created_recordset['type'], type_.upper())
|
||||
self.assertEqual(created_recordset['records'], records)
|
||||
self.assertEqual(created_recordset['description'], description)
|
||||
self.assertEqual(created_recordset['ttl'], ttl)
|
||||
|
||||
# Test that we can list recordsets
|
||||
recordsets = self.demo_cloud.list_recordsets(zone)
|
||||
@ -66,23 +66,23 @@ class TestRecordset(base.BaseFunctionalTestCase):
|
||||
# Test we get the same recordset with the get_recordset method
|
||||
get_recordset = self.demo_cloud.get_recordset(zone,
|
||||
created_recordset['id'])
|
||||
self.assertEquals(get_recordset['id'], created_recordset['id'])
|
||||
self.assertEqual(get_recordset['id'], created_recordset['id'])
|
||||
|
||||
# Test the get method also works by name
|
||||
get_recordset = self.demo_cloud.get_recordset(zone, name + '.' + zone)
|
||||
self.assertEquals(get_recordset['id'], created_recordset['id'])
|
||||
self.assertEqual(get_recordset['id'], created_recordset['id'])
|
||||
|
||||
# Test we can update a field on the recordset and only that field
|
||||
# is updated
|
||||
updated_recordset = self.demo_cloud.update_recordset(zone_obj['id'],
|
||||
name + '.' + zone,
|
||||
ttl=7200)
|
||||
self.assertEquals(updated_recordset['id'], created_recordset['id'])
|
||||
self.assertEquals(updated_recordset['name'], name + '.' + zone)
|
||||
self.assertEquals(updated_recordset['type'], type_.upper())
|
||||
self.assertEquals(updated_recordset['records'], records)
|
||||
self.assertEquals(updated_recordset['description'], description)
|
||||
self.assertEquals(updated_recordset['ttl'], 7200)
|
||||
self.assertEqual(updated_recordset['id'], created_recordset['id'])
|
||||
self.assertEqual(updated_recordset['name'], name + '.' + zone)
|
||||
self.assertEqual(updated_recordset['type'], type_.upper())
|
||||
self.assertEqual(updated_recordset['records'], records)
|
||||
self.assertEqual(updated_recordset['description'], description)
|
||||
self.assertEqual(updated_recordset['ttl'], 7200)
|
||||
|
||||
# Test we can delete and get True returned
|
||||
deleted_recordset = self.demo_cloud.delete_recordset(
|
||||
|
@ -48,12 +48,12 @@ class TestZone(base.BaseFunctionalTestCase):
|
||||
name=name, zone_type=zone_type, email=email,
|
||||
description=description, ttl=ttl,
|
||||
masters=masters)
|
||||
self.assertEquals(zone['name'], name)
|
||||
self.assertEquals(zone['type'], zone_type.upper())
|
||||
self.assertEquals(zone['email'], email)
|
||||
self.assertEquals(zone['description'], description)
|
||||
self.assertEquals(zone['ttl'], ttl)
|
||||
self.assertEquals(zone['masters'], [])
|
||||
self.assertEqual(zone['name'], name)
|
||||
self.assertEqual(zone['type'], zone_type.upper())
|
||||
self.assertEqual(zone['email'], email)
|
||||
self.assertEqual(zone['description'], description)
|
||||
self.assertEqual(zone['ttl'], ttl)
|
||||
self.assertEqual(zone['masters'], [])
|
||||
|
||||
# Test that we can list zones
|
||||
zones = self.demo_cloud.list_zones()
|
||||
@ -61,22 +61,22 @@ class TestZone(base.BaseFunctionalTestCase):
|
||||
|
||||
# Test we get the same zone with the get_zone method
|
||||
zone_get = self.demo_cloud.get_zone(zone['id'])
|
||||
self.assertEquals(zone_get['id'], zone['id'])
|
||||
self.assertEqual(zone_get['id'], zone['id'])
|
||||
|
||||
# Test the get method also works by name
|
||||
zone_get = self.demo_cloud.get_zone(name)
|
||||
self.assertEquals(zone_get['name'], zone['name'])
|
||||
self.assertEqual(zone_get['name'], zone['name'])
|
||||
|
||||
# Test we can update a field on the zone and only that field
|
||||
# is updated
|
||||
zone_update = self.demo_cloud.update_zone(zone['id'], ttl=7200)
|
||||
self.assertEquals(zone_update['id'], zone['id'])
|
||||
self.assertEquals(zone_update['name'], zone['name'])
|
||||
self.assertEquals(zone_update['type'], zone['type'])
|
||||
self.assertEquals(zone_update['email'], zone['email'])
|
||||
self.assertEquals(zone_update['description'], zone['description'])
|
||||
self.assertEquals(zone_update['ttl'], 7200)
|
||||
self.assertEquals(zone_update['masters'], zone['masters'])
|
||||
self.assertEqual(zone_update['id'], zone['id'])
|
||||
self.assertEqual(zone_update['name'], zone['name'])
|
||||
self.assertEqual(zone_update['type'], zone['type'])
|
||||
self.assertEqual(zone_update['email'], zone['email'])
|
||||
self.assertEqual(zone_update['description'], zone['description'])
|
||||
self.assertEqual(zone_update['ttl'], 7200)
|
||||
self.assertEqual(zone_update['masters'], zone['masters'])
|
||||
|
||||
# Test we can delete and get True returned
|
||||
zone_delete = self.demo_cloud.delete_zone(zone['id'])
|
||||
|
@ -36,14 +36,14 @@ class TestUtils(base.TestCase):
|
||||
el2 = dict(id=200, name='pluto')
|
||||
data = [el1, el2]
|
||||
ret = _utils._filter_list(data, 'donald', None)
|
||||
self.assertEquals([el1], ret)
|
||||
self.assertEqual([el1], ret)
|
||||
|
||||
def test__filter_list_filter(self):
|
||||
el1 = dict(id=100, name='donald', other='duck')
|
||||
el2 = dict(id=200, name='donald', other='trump')
|
||||
data = [el1, el2]
|
||||
ret = _utils._filter_list(data, 'donald', {'other': 'duck'})
|
||||
self.assertEquals([el1], ret)
|
||||
self.assertEqual([el1], ret)
|
||||
|
||||
def test__filter_list_dict1(self):
|
||||
el1 = dict(id=100, name='donald', last='duck',
|
||||
@ -55,7 +55,7 @@ class TestUtils(base.TestCase):
|
||||
data = [el1, el2, el3]
|
||||
ret = _utils._filter_list(
|
||||
data, 'donald', {'other': {'category': 'clown'}})
|
||||
self.assertEquals([el3], ret)
|
||||
self.assertEqual([el3], ret)
|
||||
|
||||
def test__filter_list_dict2(self):
|
||||
el1 = dict(id=100, name='donald', last='duck',
|
||||
@ -70,7 +70,7 @@ class TestUtils(base.TestCase):
|
||||
{'other': {
|
||||
'financial': {'status': 'rich'}
|
||||
}})
|
||||
self.assertEquals([el2, el3], ret)
|
||||
self.assertEqual([el2, el3], ret)
|
||||
|
||||
def test_normalize_nova_secgroups(self):
|
||||
nova_secgroup = dict(
|
||||
|
@ -97,8 +97,8 @@ class TestClusterTemplates(base.TestCase):
|
||||
name_or_id='fake-cluster-template')
|
||||
mock_magnum.baymodels.list.assert_called_with(detail=False)
|
||||
|
||||
self.assertEquals(1, len(cluster_templates))
|
||||
self.assertEquals('fake-uuid', cluster_templates[0]['uuid'])
|
||||
self.assertEqual(1, len(cluster_templates))
|
||||
self.assertEqual('fake-uuid', cluster_templates[0]['uuid'])
|
||||
|
||||
@mock.patch.object(shade.OpenStackCloud, 'magnum_client')
|
||||
def test_search_cluster_templates_not_found(self, mock_magnum):
|
||||
@ -109,7 +109,7 @@ class TestClusterTemplates(base.TestCase):
|
||||
name_or_id='non-existent')
|
||||
|
||||
mock_magnum.baymodels.list.assert_called_with(detail=False)
|
||||
self.assertEquals(0, len(cluster_templates))
|
||||
self.assertEqual(0, len(cluster_templates))
|
||||
|
||||
@mock.patch.object(shade.OpenStackCloud, 'search_cluster_templates')
|
||||
def test_get_cluster_template(self, mock_search):
|
||||
|
@ -89,7 +89,7 @@ class TestCloudEndpoints(base.TestCase):
|
||||
|
||||
# test keys and values are correct
|
||||
for k, v in self.mock_endpoints[2].items():
|
||||
self.assertEquals(v, endpoints[0].get(k))
|
||||
self.assertEqual(v, endpoints[0].get(k))
|
||||
|
||||
# test v3 semantics on v2.0 endpoint
|
||||
mock_keystone_client.endpoints.create.return_value = \
|
||||
@ -110,7 +110,7 @@ class TestCloudEndpoints(base.TestCase):
|
||||
|
||||
# test keys and values are correct
|
||||
for k, v in self.mock_endpoints[0].items():
|
||||
self.assertEquals(v, endpoints_3on2[0].get(k))
|
||||
self.assertEqual(v, endpoints_3on2[0].get(k))
|
||||
|
||||
@patch.object(OperatorCloud, 'list_services')
|
||||
@patch.object(OperatorCloud, 'keystone_client')
|
||||
@ -146,7 +146,7 @@ class TestCloudEndpoints(base.TestCase):
|
||||
|
||||
# test keys and values are correct
|
||||
for k, v in self.mock_endpoints_v3[0].items():
|
||||
self.assertEquals(v, endpoints[0].get(k))
|
||||
self.assertEqual(v, endpoints[0].get(k))
|
||||
|
||||
# test v2.0 semantics on v3 endpoint
|
||||
mock_keystone_client.endpoints.create.side_effect = \
|
||||
@ -161,12 +161,12 @@ class TestCloudEndpoints(base.TestCase):
|
||||
)
|
||||
|
||||
# Three endpoints should be returned, public, internal, and admin
|
||||
self.assertEquals(len(endpoints_2on3), 3)
|
||||
self.assertEqual(len(endpoints_2on3), 3)
|
||||
|
||||
# test keys and values are correct
|
||||
for count in range(len(endpoints_2on3)):
|
||||
for k, v in self.mock_endpoints_v3[count].items():
|
||||
self.assertEquals(v, endpoints_2on3[count].get(k))
|
||||
self.assertEqual(v, endpoints_2on3[count].get(k))
|
||||
|
||||
@patch.object(os_client_config.cloud_config.CloudConfig, 'get_api_version')
|
||||
def test_update_endpoint_v2(self, mock_api_version):
|
||||
@ -201,7 +201,7 @@ class TestCloudEndpoints(base.TestCase):
|
||||
|
||||
# test keys and values are correct
|
||||
for k, v in self.mock_endpoints_v3[0].items():
|
||||
self.assertEquals(v, endpoint.get(k))
|
||||
self.assertEqual(v, endpoint.get(k))
|
||||
|
||||
@patch.object(OperatorCloud, 'keystone_client')
|
||||
def test_list_endpoints(self, mock_keystone_client):
|
||||
@ -221,7 +221,7 @@ class TestCloudEndpoints(base.TestCase):
|
||||
if e['id'] == mock_endpoint['id']:
|
||||
found = True
|
||||
for k, v in mock_endpoint.items():
|
||||
self.assertEquals(v, e.get(k))
|
||||
self.assertEqual(v, e.get(k))
|
||||
break
|
||||
self.assertTrue(
|
||||
found, msg="endpoint {id} not found!".format(
|
||||
@ -237,7 +237,7 @@ class TestCloudEndpoints(base.TestCase):
|
||||
# # test we are getting exactly 1 element
|
||||
self.assertEqual(1, len(endpoints))
|
||||
for k, v in self.mock_endpoints[2].items():
|
||||
self.assertEquals(v, endpoints[0].get(k))
|
||||
self.assertEqual(v, endpoints[0].get(k))
|
||||
|
||||
# Not found
|
||||
endpoints = self.op_cloud.search_endpoints(id='blah!')
|
||||
|
@ -38,7 +38,7 @@ class TestFlavors(base.TestCase):
|
||||
|
||||
# test that we have a new flavor added
|
||||
new_flavors = self.full_op_cloud.list_flavors()
|
||||
self.assertEquals(len(new_flavors) - len(old_flavors), 1)
|
||||
self.assertEqual(len(new_flavors) - len(old_flavors), 1)
|
||||
|
||||
# test that new flavor is created correctly
|
||||
found = False
|
||||
|
@ -643,19 +643,19 @@ class TestMeta(base.TestCase):
|
||||
self.assertEqual(PUBLIC_V4, hostvars['public_v4'])
|
||||
self.assertEqual(PUBLIC_V6, hostvars['public_v6'])
|
||||
self.assertEqual(PUBLIC_V6, hostvars['interface_ip'])
|
||||
self.assertEquals('REGION_NAME', hostvars['region'])
|
||||
self.assertEquals('CLOUD_NAME', hostvars['cloud'])
|
||||
self.assertEquals("test-image-name", hostvars['image']['name'])
|
||||
self.assertEquals(standard_fake_server.image['id'],
|
||||
hostvars['image']['id'])
|
||||
self.assertEqual('REGION_NAME', hostvars['region'])
|
||||
self.assertEqual('CLOUD_NAME', hostvars['cloud'])
|
||||
self.assertEqual("test-image-name", hostvars['image']['name'])
|
||||
self.assertEqual(
|
||||
standard_fake_server.image['id'], hostvars['image']['id'])
|
||||
self.assertNotIn('links', hostvars['image'])
|
||||
self.assertEquals(standard_fake_server.flavor['id'],
|
||||
hostvars['flavor']['id'])
|
||||
self.assertEquals("test-flavor-name", hostvars['flavor']['name'])
|
||||
self.assertEqual(
|
||||
standard_fake_server.flavor['id'], hostvars['flavor']['id'])
|
||||
self.assertEqual("test-flavor-name", hostvars['flavor']['name'])
|
||||
self.assertNotIn('links', hostvars['flavor'])
|
||||
# test having volumes
|
||||
# test volume exception
|
||||
self.assertEquals([], hostvars['volumes'])
|
||||
self.assertEqual([], hostvars['volumes'])
|
||||
|
||||
@mock.patch.object(shade.meta, 'get_server_external_ipv6')
|
||||
@mock.patch.object(shade.meta, 'get_server_external_ipv4')
|
||||
@ -689,7 +689,7 @@ class TestMeta(base.TestCase):
|
||||
server.image = 'fake-image-id'
|
||||
hostvars = meta.get_hostvars_from_server(
|
||||
FakeCloud(), meta.obj_to_dict(server))
|
||||
self.assertEquals('fake-image-id', hostvars['image']['id'])
|
||||
self.assertEqual('fake-image-id', hostvars['image']['id'])
|
||||
|
||||
def test_az(self):
|
||||
server = standard_fake_server
|
||||
@ -698,7 +698,7 @@ class TestMeta(base.TestCase):
|
||||
hostvars = _utils.normalize_server(
|
||||
meta.obj_to_dict(server),
|
||||
cloud_name='', region_name='')
|
||||
self.assertEquals('az1', hostvars['az'])
|
||||
self.assertEqual('az1', hostvars['az'])
|
||||
|
||||
def test_has_volume(self):
|
||||
mock_cloud = mock.MagicMock()
|
||||
@ -712,15 +712,15 @@ class TestMeta(base.TestCase):
|
||||
mock_cloud.get_volumes.return_value = [fake_volume_dict]
|
||||
hostvars = meta.get_hostvars_from_server(
|
||||
mock_cloud, meta.obj_to_dict(standard_fake_server))
|
||||
self.assertEquals('volume1', hostvars['volumes'][0]['id'])
|
||||
self.assertEquals('/dev/sda0', hostvars['volumes'][0]['device'])
|
||||
self.assertEqual('volume1', hostvars['volumes'][0]['id'])
|
||||
self.assertEqual('/dev/sda0', hostvars['volumes'][0]['device'])
|
||||
|
||||
def test_has_no_volume_service(self):
|
||||
fake_cloud = FakeCloud()
|
||||
fake_cloud.service_val = False
|
||||
hostvars = meta.get_hostvars_from_server(
|
||||
fake_cloud, meta.obj_to_dict(standard_fake_server))
|
||||
self.assertEquals([], hostvars['volumes'])
|
||||
self.assertEqual([], hostvars['volumes'])
|
||||
|
||||
def test_unknown_volume_exception(self):
|
||||
mock_cloud = mock.MagicMock()
|
||||
@ -746,7 +746,7 @@ class TestMeta(base.TestCase):
|
||||
self.assertNotIn('get_flavor_name', cloud_dict)
|
||||
self.assertNotIn('server', cloud_dict)
|
||||
self.assertTrue(hasattr(cloud_dict, 'name'))
|
||||
self.assertEquals(cloud_dict.name, cloud_dict['name'])
|
||||
self.assertEqual(cloud_dict.name, cloud_dict['name'])
|
||||
|
||||
def test_obj_to_dict_subclass(self):
|
||||
class FakeObjDict(dict):
|
||||
@ -755,8 +755,8 @@ class TestMeta(base.TestCase):
|
||||
obj_dict = meta.obj_to_dict(obj)
|
||||
self.assertIn('additional', obj_dict)
|
||||
self.assertIn('foo', obj_dict)
|
||||
self.assertEquals(obj_dict['additional'], 1)
|
||||
self.assertEquals(obj_dict['foo'], 'bar')
|
||||
self.assertEqual(obj_dict['additional'], 1)
|
||||
self.assertEqual(obj_dict['foo'], 'bar')
|
||||
|
||||
def test_warlock_to_dict(self):
|
||||
schema = {
|
||||
@ -775,4 +775,4 @@ class TestMeta(base.TestCase):
|
||||
self.assertNotIn('_unused', test_dict)
|
||||
self.assertEqual('test-image', test_dict['name'])
|
||||
self.assertTrue(hasattr(test_dict, 'name'))
|
||||
self.assertEquals(test_dict.name, test_dict['name'])
|
||||
self.assertEqual(test_dict.name, test_dict['name'])
|
||||
|
@ -229,8 +229,8 @@ class TestPort(base.TestCase):
|
||||
name_or_id='f71a6703-d6de-4be1-a91a-a570ede1d159')
|
||||
|
||||
mock_neutron_client.list_ports.assert_called_with()
|
||||
self.assertEquals(1, len(ports))
|
||||
self.assertEquals('fa:16:3e:bb:3c:e4', ports[0]['mac_address'])
|
||||
self.assertEqual(1, len(ports))
|
||||
self.assertEqual('fa:16:3e:bb:3c:e4', ports[0]['mac_address'])
|
||||
|
||||
@patch.object(OpenStackCloud, 'neutron_client')
|
||||
def test_search_ports_by_name(self, mock_neutron_client):
|
||||
@ -240,8 +240,8 @@ class TestPort(base.TestCase):
|
||||
ports = self.cloud.search_ports(name_or_id='first-port')
|
||||
|
||||
mock_neutron_client.list_ports.assert_called_with()
|
||||
self.assertEquals(1, len(ports))
|
||||
self.assertEquals('fa:16:3e:58:42:ed', ports[0]['mac_address'])
|
||||
self.assertEqual(1, len(ports))
|
||||
self.assertEqual('fa:16:3e:58:42:ed', ports[0]['mac_address'])
|
||||
|
||||
@patch.object(OpenStackCloud, 'neutron_client')
|
||||
def test_search_ports_not_found(self, mock_neutron_client):
|
||||
@ -251,7 +251,7 @@ class TestPort(base.TestCase):
|
||||
ports = self.cloud.search_ports(name_or_id='non-existent')
|
||||
|
||||
mock_neutron_client.list_ports.assert_called_with()
|
||||
self.assertEquals(0, len(ports))
|
||||
self.assertEqual(0, len(ports))
|
||||
|
||||
@patch.object(OpenStackCloud, 'neutron_client')
|
||||
def test_delete_port(self, mock_neutron_client):
|
||||
|
@ -513,7 +513,7 @@ class TestShade(base.TestCase):
|
||||
mock_response.json.return_value = dict(extra_specs=[])
|
||||
mock_compute.get.return_value = mock_response
|
||||
flavor = self.cloud.get_flavor_by_ram(ram=150)
|
||||
self.assertEquals(chocolate.id, flavor['id'])
|
||||
self.assertEqual(chocolate.id, flavor['id'])
|
||||
|
||||
@mock.patch.object(shade.OpenStackCloud, '_compute_client')
|
||||
@mock.patch.object(shade.OpenStackCloud, 'nova_client')
|
||||
@ -528,7 +528,7 @@ class TestShade(base.TestCase):
|
||||
mock_nova_client.flavors.list.return_value = [
|
||||
vanilla, chocolate, strawberry]
|
||||
flavor = self.cloud.get_flavor_by_ram(ram=150, include='strawberry')
|
||||
self.assertEquals(strawberry.id, flavor['id'])
|
||||
self.assertEqual(strawberry.id, flavor['id'])
|
||||
|
||||
@mock.patch.object(shade.OpenStackCloud, 'nova_client')
|
||||
def test_get_flavor_by_ram_not_found(self, mock_nova_client):
|
||||
@ -547,9 +547,9 @@ class TestShade(base.TestCase):
|
||||
mock_response.json.return_value = dict(extra_specs=[])
|
||||
mock_compute.get.return_value = mock_response
|
||||
flavor1 = self.cloud.get_flavor('1')
|
||||
self.assertEquals(vanilla.id, flavor1['id'])
|
||||
self.assertEqual(vanilla.id, flavor1['id'])
|
||||
flavor2 = self.cloud.get_flavor(1)
|
||||
self.assertEquals(vanilla.id, flavor2['id'])
|
||||
self.assertEqual(vanilla.id, flavor2['id'])
|
||||
|
||||
def test__neutron_exceptions_resource_not_found(self):
|
||||
with mock.patch.object(
|
||||
@ -596,9 +596,9 @@ class TestShade(base.TestCase):
|
||||
|
||||
r = self.cloud.list_servers()
|
||||
|
||||
self.assertEquals(1, len(r))
|
||||
self.assertEquals(1, mock_add_srv_int.call_count)
|
||||
self.assertEquals('testserver', r[0]['name'])
|
||||
self.assertEqual(1, len(r))
|
||||
self.assertEqual(1, mock_add_srv_int.call_count)
|
||||
self.assertEqual('testserver', r[0]['name'])
|
||||
|
||||
@mock.patch.object(shade._tasks.ServerList, 'main')
|
||||
@mock.patch('shade.meta.get_hostvars_from_server')
|
||||
@ -619,10 +619,10 @@ class TestShade(base.TestCase):
|
||||
|
||||
r = self.cloud.list_servers(detailed=True)
|
||||
|
||||
self.assertEquals(2, len(r))
|
||||
self.assertEquals(len(r), mock_get_hostvars_from_server.call_count)
|
||||
self.assertEquals('server1', r[0]['name'])
|
||||
self.assertEquals('server2', r[1]['name'])
|
||||
self.assertEqual(2, len(r))
|
||||
self.assertEqual(len(r), mock_get_hostvars_from_server.call_count)
|
||||
self.assertEqual('server1', r[0]['name'])
|
||||
self.assertEqual('server2', r[1]['name'])
|
||||
|
||||
def test_iterate_timeout_bad_wait(self):
|
||||
with testtools.ExpectedException(
|
||||
|
@ -1116,6 +1116,6 @@ class TestShadeOperator(base.TestCase):
|
||||
|
||||
r = self.op_cloud.list_hypervisors()
|
||||
mock_nova.hypervisors.list.assert_called_once_with()
|
||||
self.assertEquals(2, len(r))
|
||||
self.assertEquals('testserver1', r[0]['hypervisor_hostname'])
|
||||
self.assertEquals('testserver2', r[1]['hypervisor_hostname'])
|
||||
self.assertEqual(2, len(r))
|
||||
self.assertEqual('testserver1', r[0]['hypervisor_hostname'])
|
||||
self.assertEqual('testserver2', r[1]['hypervisor_hostname'])
|
||||
|
4
tox.ini
4
tox.ini
@ -54,7 +54,9 @@ commands = python setup.py build_sphinx
|
||||
|
||||
[flake8]
|
||||
# Infra does not follow hacking, nor the broken E12* things
|
||||
ignore = E123,E125,E129,H
|
||||
# The string of H ignores is because there are some useful checks
|
||||
# related to python3 compat.
|
||||
ignore = E123,E125,E129,H3,H4,H5,H6,H7,H8,H103,H201,H238
|
||||
show-source = True
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||
|
Loading…
Reference in New Issue
Block a user