From e448b2f5f7094ed64a203785221c88edd1dd88b8 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Tue, 30 Jul 2013 17:16:59 +0200 Subject: [PATCH] Fake http_connect in test_replicator test - mock http_connect in replicator.test_delete_partition test to not connect directly on 127.0.0.1 (which is not always avail on non linuxies). - Fixes bug 1203907 Change-Id: I2622223c9fe5a3db2a113b6cd8d028a5db0915a7 --- test/unit/obj/test_replicator.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/unit/obj/test_replicator.py b/test/unit/obj/test_replicator.py index f2960f8365..4eb1ef10ad 100644 --- a/test/unit/obj/test_replicator.py +++ b/test/unit/obj/test_replicator.py @@ -287,13 +287,15 @@ class TestObjectReplicator(unittest.TestCase): self.replicator.logger.log_dict['warning']) def test_delete_partition(self): - df = diskfile.DiskFile(self.devices, 'sda', '0', 'a', 'c', 'o', - FakeLogger()) - mkdirs(df.datadir) - part_path = os.path.join(self.objects, '1') - self.assertTrue(os.access(part_path, os.F_OK)) - self.replicator.replicate() - self.assertFalse(os.access(part_path, os.F_OK)) + with mock.patch('swift.obj.replicator.http_connect', + mock_http_connect(200)): + df = diskfile.DiskFile(self.devices, + 'sda', '0', 'a', 'c', 'o', FakeLogger()) + mkdirs(df.datadir) + part_path = os.path.join(self.objects, '1') + self.assertTrue(os.access(part_path, os.F_OK)) + self.replicator.replicate() + self.assertFalse(os.access(part_path, os.F_OK)) def test_delete_partition_override_params(self): df = diskfile.DiskFile(self.devices, 'sda', '0', 'a', 'c', 'o',