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
This commit is contained in:
Chmouel Boudjnah 2013-07-30 17:16:59 +02:00
parent a11ecc35b7
commit e448b2f5f7

@ -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',