Merge "Python 3: fix neutron.tests.unit.agent.dhcp.test_agent"

This commit is contained in:
Jenkins 2015-07-24 05:52:05 +00:00 committed by Gerrit Code Review
commit 5ba4fa846d
2 changed files with 5 additions and 3 deletions

View File

@ -400,13 +400,14 @@ class TestDhcpAgent(base.BaseTestCase):
def test_periodic_resync_helper(self):
with mock.patch.object(dhcp_agent.eventlet, 'sleep') as sleep:
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
dhcp.needs_resync_reasons = collections.OrderedDict(
resync_reasons = collections.OrderedDict(
(('a', 'reason1'), ('b', 'reason2')))
dhcp.needs_resync_reasons = resync_reasons
with mock.patch.object(dhcp, 'sync_state') as sync_state:
sync_state.side_effect = RuntimeError
with testtools.ExpectedException(RuntimeError):
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)
self.assertEqual(len(dhcp.needs_resync_reasons), 0)
@ -1062,7 +1063,7 @@ class TestNetworkCache(base.BaseTestCase):
nc = dhcp_agent.NetworkCache()
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):
nc = dhcp_agent.NetworkCache()

View File

@ -206,6 +206,7 @@ commands = python -m testtools.run \
neutron.tests.unit.agent.linux.test_bridge_lib \
neutron.tests.unit.agent.linux.test_ip_link_support \
neutron.tests.unit.agent.linux.test_interface \
neutron.tests.unit.agent.dhcp.test_agent \
neutron.tests.unit.test_manager \
neutron.tests.unit.test_service \
neutron.tests.unit.test_auth \