change assert(Not)Equals to assert(Not)Equal

According to http://docs.python.org/2/library/unittest.html
assert(Not)Equals is a deprecated alias of assert(Not)Equal.

Change-Id: Ie0dfc9172f66086fbb7d5ffd569e654e8d10acfa
Closes-Bug: #1329757
This commit is contained in:
zhangyangyang 2017-09-12 18:20:09 +08:00
parent ace1b34fed
commit a525949136
2 changed files with 54 additions and 54 deletions

View File

@ -65,13 +65,13 @@ class TestL3AgentContext(CharmTestCase):
self.test_config.set('run-internal-router', 'none')
self.test_config.set('external-network-id', '')
self.eligible_leader.return_value = False
self.assertEquals(neutron_contexts.L3AgentContext()(),
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'external_configuration_new': True,
'handle_internal_only_router': False,
'plugin': 'ovs'})
self.assertEqual(neutron_contexts.L3AgentContext()(),
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'external_configuration_new': True,
'handle_internal_only_router': False,
'plugin': 'ovs'})
@patch('neutron_contexts.NeutronAPIContext')
def test_old_ext_network(self, _NeutronAPIContext):
@ -83,12 +83,12 @@ class TestL3AgentContext(CharmTestCase):
self.test_config.set('run-internal-router', 'none')
self.test_config.set('ext-port', 'eth1')
self.eligible_leader.return_value = False
self.assertEquals(neutron_contexts.L3AgentContext()(),
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'handle_internal_only_router': False,
'plugin': 'ovs'})
self.assertEqual(neutron_contexts.L3AgentContext()(),
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'handle_internal_only_router': False,
'plugin': 'ovs'})
@patch('neutron_contexts.NeutronAPIContext')
def test_hior_leader(self, _NeutronAPIContext):
@ -100,13 +100,13 @@ class TestL3AgentContext(CharmTestCase):
self.test_config.set('run-internal-router', 'leader')
self.test_config.set('external-network-id', 'netid')
self.eligible_leader.return_value = True
self.assertEquals(neutron_contexts.L3AgentContext()(),
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'handle_internal_only_router': True,
'ext_net_id': 'netid',
'plugin': 'ovs'})
self.assertEqual(neutron_contexts.L3AgentContext()(),
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'handle_internal_only_router': True,
'ext_net_id': 'netid',
'plugin': 'ovs'})
@patch('neutron_contexts.NeutronAPIContext')
def test_hior_all(self, _NeutronAPIContext):
@ -118,13 +118,13 @@ class TestL3AgentContext(CharmTestCase):
self.test_config.set('run-internal-router', 'all')
self.test_config.set('external-network-id', 'netid')
self.eligible_leader.return_value = True
self.assertEquals(neutron_contexts.L3AgentContext()(),
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'handle_internal_only_router': True,
'ext_net_id': 'netid',
'plugin': 'ovs'})
self.assertEqual(neutron_contexts.L3AgentContext()(),
{'agent_mode': 'legacy',
'report_interval': 30,
'rpc_response_timeout': 60,
'handle_internal_only_router': True,
'ext_net_id': 'netid',
'plugin': 'ovs'})
@patch('neutron_contexts.NeutronAPIContext')
def test_dvr(self, _NeutronAPIContext):
@ -133,8 +133,8 @@ class TestL3AgentContext(CharmTestCase):
'report_interval': 30,
'rpc_response_timeout': 60,
})
self.assertEquals(neutron_contexts.L3AgentContext()()['agent_mode'],
'dvr_snat')
self.assertEqual(neutron_contexts.L3AgentContext()()['agent_mode'],
'dvr_snat')
class TestNeutronGatewayContext(CharmTestCase):
@ -174,7 +174,7 @@ class TestNeutronGatewayContext(CharmTestCase):
_rget.side_effect = lambda *args, **kwargs: rdata
_secret.return_value = 'testsecret'
ctxt = neutron_contexts.NeutronGatewayContext()()
self.assertEquals(ctxt, {
self.assertEqual(ctxt, {
'shared_secret': 'testsecret',
'enable_dvr': True,
'enable_l3ha': True,
@ -231,7 +231,7 @@ class TestNeutronGatewayContext(CharmTestCase):
_rget.side_effect = lambda *args, **kwargs: rdata
_secret.return_value = 'testsecret'
ctxt = neutron_contexts.NeutronGatewayContext()()
self.assertEquals(ctxt, {
self.assertEqual(ctxt, {
'shared_secret': 'testsecret',
'enable_dvr': True,
'enable_l3ha': True,
@ -302,8 +302,8 @@ class TestSharedSecret(CharmTestCase):
_path.exists.return_value = False
_uuid4.return_value = 'secret_thing'
with patch_open() as (_open, _file):
self.assertEquals(neutron_contexts.get_shared_secret(),
'secret_thing')
self.assertEqual(neutron_contexts.get_shared_secret(),
'secret_thing')
_open.assert_called_with(
neutron_contexts.SHARED_SECRET.format('neutron'), 'w')
_file.write.assert_called_with('secret_thing')
@ -313,8 +313,8 @@ class TestSharedSecret(CharmTestCase):
_path.exists.return_value = True
with patch_open() as (_open, _file):
_file.read.return_value = 'secret_thing\n'
self.assertEquals(neutron_contexts.get_shared_secret(),
'secret_thing')
self.assertEqual(neutron_contexts.get_shared_secret(),
'secret_thing')
_open.assert_called_with(
neutron_contexts.SHARED_SECRET.format('neutron'), 'r')
@ -341,13 +341,13 @@ class TestHostIP(CharmTestCase):
del sys.modules[mod]
def test_get_host_ip_already_ip(self):
self.assertEquals(neutron_contexts.get_host_ip('10.5.0.1'),
'10.5.0.1')
self.assertEqual(neutron_contexts.get_host_ip('10.5.0.1'),
'10.5.0.1')
def test_get_host_ip_noarg(self):
self.unit_get.return_value = "10.5.0.1"
self.assertEquals(neutron_contexts.get_host_ip(),
'10.5.0.1')
self.assertEqual(neutron_contexts.get_host_ip(),
'10.5.0.1')
@patch('dns.resolver.query')
def test_get_host_ip_hostname_unresolvable(self, _query):
@ -362,8 +362,8 @@ class TestHostIP(CharmTestCase):
data = MagicMock()
data.address = '10.5.0.1'
_query.return_value = [data]
self.assertEquals(neutron_contexts.get_host_ip('myhost.example.com'),
'10.5.0.1')
self.assertEqual(neutron_contexts.get_host_ip('myhost.example.com'),
'10.5.0.1')
_query.assert_called_with('myhost.example.com', 'A')
@ -376,5 +376,5 @@ class TestMisc(CharmTestCase):
def test_core_plugin_ml2(self):
self.config.return_value = 'ovs'
self.assertEquals(neutron_contexts.core_plugin(),
neutron_contexts.NEUTRON_ML2_PLUGIN)
self.assertEqual(neutron_contexts.core_plugin(),
neutron_contexts.NEUTRON_ML2_PLUGIN)

View File

@ -94,20 +94,20 @@ class TestNeutronUtils(CharmTestCase):
self.config.return_value = 'ovs'
self.determine_dkms_package.return_value = [
'openvswitch-datapath-dkms']
self.assertEquals(
self.assertEqual(
neutron_utils.get_early_packages(),
['openvswitch-datapath-dkms', 'linux-headers-2.6.18'])
def test_get_early_packages_nsx(self):
self.config.return_value = 'nsx'
self.assertEquals(
self.assertEqual(
neutron_utils.get_early_packages(),
[])
def test_get_early_packages_empty(self):
self.config.return_value = 'noop'
self.assertEquals(neutron_utils.get_early_packages(),
[])
self.assertEqual(neutron_utils.get_early_packages(),
[])
@patch.object(neutron_utils, 'git_install_requested')
def test_get_packages_ovs_icehouse(self, git_requested):
@ -985,17 +985,17 @@ class TestNeutronAgentReallocation(CharmTestCase):
call('neutron', shell='/bin/bash', system_user=True),
call('nova', shell='/bin/bash', system_user=True),
]
self.assertEquals(adduser.call_args_list, expected)
self.assertEqual(adduser.call_args_list, expected)
expected = [
call('neutron', system_group=True),
call('nova', system_group=True),
]
self.assertEquals(add_group.call_args_list, expected)
self.assertEqual(add_group.call_args_list, expected)
expected = [
call('neutron', 'neutron'),
call('nova', 'nova'),
]
self.assertEquals(add_user_to_group.call_args_list, expected)
self.assertEqual(add_user_to_group.call_args_list, expected)
expected = [
call('/etc/neutron', owner='neutron',
group='neutron', perms=0755, force=False),
@ -1016,7 +1016,7 @@ class TestNeutronAgentReallocation(CharmTestCase):
call('/var/log/nova', owner='neutron',
group='neutron', perms=0755, force=False),
]
self.assertEquals(mkdir.call_args_list, expected)
self.assertEqual(mkdir.call_args_list, expected)
expected = [
call('/var/log/neutron/bigswitch-agent.log', '', owner='neutron',
group='neutron', perms=0644),
@ -1055,7 +1055,7 @@ class TestNeutronAgentReallocation(CharmTestCase):
call('/var/log/neutron/vpn_agent.log', '', owner='neutron',
group='neutron', perms=0644),
]
self.assertEquals(write_file.call_args_list, expected)
self.assertEqual(write_file.call_args_list, expected)
@patch('os.remove')
@patch('os.path.join')
@ -1380,7 +1380,7 @@ class TestNeutronAgentReallocation(CharmTestCase):
nova_api_metadata_context, perms=0o644,
templates_dir='joined-string'),
]
self.assertEquals(self.render.call_args_list, expected)
self.assertEqual(self.render.call_args_list, expected)
@patch('os.listdir')
@patch('os.remove')
@ -1458,7 +1458,7 @@ class TestNeutronAgentReallocation(CharmTestCase):
'joined-string', {'daemon_path': 'joined-string'},
perms=420),
]
self.assertEquals(self.render.call_args_list, expected)
self.assertEqual(self.render.call_args_list, expected)
def test_assess_status(self):
with patch.object(neutron_utils, 'assess_status_func') as asf: