From b31a4f6e870cb56efa40c785a868a944b964e8b9 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 25 Jun 2013 19:50:00 +0100 Subject: [PATCH] test_iputil.py: repair a test by mocking 'get_local_ip_for'. Signed-off-by: Daira Hopwood --- src/allmydata/test/test_iputil.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/test_iputil.py b/src/allmydata/test/test_iputil.py index b56b8d23..fcb10178 100644 --- a/src/allmydata/test/test_iputil.py +++ b/src/allmydata/test/test_iputil.py @@ -104,9 +104,13 @@ class ListAddresses(testutil.SignalMixin, unittest.TestCase): raise e self.patch(subprocess, 'Popen', call_Popen) + def call_get_local_ip_for(target): + return "192.168.0.10" + self.patch(iputil, 'get_local_ip_for', call_get_local_ip_for) + d = iputil.get_local_addresses_async() def _check(addresses): - self.failUnlessEquals(set(addresses), set(["127.0.0.1", "192.168.0.6", "192.168.0.2"])) + self.failUnlessEquals(set(addresses), set(["127.0.0.1", "192.168.0.6", "192.168.0.2", "192.168.0.10"])) d.addCallbacks(_check) return d -- 2.45.2