Python 3: fix neutron.tests.unit.agent.dhcp.test_agent
A simple "list vs dict_keys" issue was preventing two tests from succeeding. Change-Id: I9386ddc600005ebb1b3f5382f6e43c19d31d4213 Blueprint: neutron-python3
This commit is contained in:
parent
c5359276f6
commit
7033960d34
@ -400,13 +400,14 @@ class TestDhcpAgent(base.BaseTestCase):
|
|||||||
def test_periodic_resync_helper(self):
|
def test_periodic_resync_helper(self):
|
||||||
with mock.patch.object(dhcp_agent.eventlet, 'sleep') as sleep:
|
with mock.patch.object(dhcp_agent.eventlet, 'sleep') as sleep:
|
||||||
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
|
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
|
||||||
dhcp.needs_resync_reasons = collections.OrderedDict(
|
resync_reasons = collections.OrderedDict(
|
||||||
(('a', 'reason1'), ('b', 'reason2')))
|
(('a', 'reason1'), ('b', 'reason2')))
|
||||||
|
dhcp.needs_resync_reasons = resync_reasons
|
||||||
with mock.patch.object(dhcp, 'sync_state') as sync_state:
|
with mock.patch.object(dhcp, 'sync_state') as sync_state:
|
||||||
sync_state.side_effect = RuntimeError
|
sync_state.side_effect = RuntimeError
|
||||||
with testtools.ExpectedException(RuntimeError):
|
with testtools.ExpectedException(RuntimeError):
|
||||||
dhcp._periodic_resync_helper()
|
dhcp._periodic_resync_helper()
|
||||||
sync_state.assert_called_once_with(['a', 'b'])
|
sync_state.assert_called_once_with(resync_reasons.keys())
|
||||||
sleep.assert_called_once_with(dhcp.conf.resync_interval)
|
sleep.assert_called_once_with(dhcp.conf.resync_interval)
|
||||||
self.assertEqual(len(dhcp.needs_resync_reasons), 0)
|
self.assertEqual(len(dhcp.needs_resync_reasons), 0)
|
||||||
|
|
||||||
@ -1062,7 +1063,7 @@ class TestNetworkCache(base.BaseTestCase):
|
|||||||
nc = dhcp_agent.NetworkCache()
|
nc = dhcp_agent.NetworkCache()
|
||||||
nc.put(fake_network)
|
nc.put(fake_network)
|
||||||
|
|
||||||
self.assertEqual(nc.get_network_ids(), [fake_network.id])
|
self.assertEqual(list(nc.get_network_ids()), [fake_network.id])
|
||||||
|
|
||||||
def test_get_network_by_subnet_id(self):
|
def test_get_network_by_subnet_id(self):
|
||||||
nc = dhcp_agent.NetworkCache()
|
nc = dhcp_agent.NetworkCache()
|
||||||
|
1
tox.ini
1
tox.ini
@ -205,6 +205,7 @@ commands = python -m testtools.run \
|
|||||||
neutron.tests.unit.agent.linux.test_bridge_lib \
|
neutron.tests.unit.agent.linux.test_bridge_lib \
|
||||||
neutron.tests.unit.agent.linux.test_ip_link_support \
|
neutron.tests.unit.agent.linux.test_ip_link_support \
|
||||||
neutron.tests.unit.agent.linux.test_interface \
|
neutron.tests.unit.agent.linux.test_interface \
|
||||||
|
neutron.tests.unit.agent.dhcp.test_agent \
|
||||||
neutron.tests.unit.test_manager \
|
neutron.tests.unit.test_manager \
|
||||||
neutron.tests.unit.test_service \
|
neutron.tests.unit.test_service \
|
||||||
neutron.tests.unit.test_auth \
|
neutron.tests.unit.test_auth \
|
||||||
|
Loading…
Reference in New Issue
Block a user