Python 3: fix test_dhcp

In Python 3, dhcp.LOG.process is not called when calling dhcp.LOG.debug. Since
what we really want to know is whether dhcp.LOG.debug is called, tweak the test
a little.

Change-Id: I9c9d9a6162181d6e518a603193013c28e218cdee
Blueprint: neutron-python3
This commit is contained in:
Cyril Roelandt 2015-07-24 15:52:42 +02:00
parent dec8743b53
commit 1f76a9061d
2 changed files with 4 additions and 3 deletions

View File

@ -1652,13 +1652,13 @@ class TestDnsmasq(TestBase):
def test__output_hosts_file_log_only_twice(self):
dm = self._get_dnsmasq(FakeDualStackNetworkSingleDHCP())
with mock.patch.object(dhcp.LOG, 'process') as process:
process.return_value = ('fake_message', {})
with mock.patch.object(dhcp, 'LOG') as logger:
logger.process.return_value = ('fake_message', {})
dm._output_hosts_file()
# The method logs twice, at the start of and the end. There should be
# no other logs, no matter how many hosts there are to dump in the
# file.
self.assertEqual(2, process.call_count)
self.assertEqual(2, len(logger.method_calls))
def test_only_populates_dhcp_enabled_subnets(self):
exp_host_name = '/dhcp/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/host'

View File

@ -201,6 +201,7 @@ commands = python -m testtools.run \
neutron.tests.unit.agent.linux.test_ip_monitor \
neutron.tests.unit.agent.linux.test_iptables_manager \
neutron.tests.unit.agent.linux.test_external_process \
neutron.tests.unit.agent.linux.test_dhcp \
neutron.tests.unit.agent.linux.test_async_process \
neutron.tests.unit.agent.linux.test_ovsdb_monitor \
neutron.tests.unit.agent.linux.test_bridge_lib \