Example #1
0
 def test_complete_rsync_with_bad_input(self):
     drive = '/some/root'
     db_file = __file__
     args = ['old_file']
     rpc = db_replicator.ReplicatorRpc('/', '/', FakeBroker, False)
     resp = rpc.complete_rsync(drive, db_file, args)
     self.assertTrue(isinstance(resp, HTTPException))
     self.assertEquals(404, resp.status_int)
     resp = rpc.complete_rsync(drive, 'new_db_file', args)
     self.assertTrue(isinstance(resp, HTTPException))
     self.assertEquals(404, resp.status_int)
Example #2
0
 def test_complete_rsync(self):
     drive = mkdtemp()
     args = ['old_file']
     rpc = db_replicator.ReplicatorRpc('/', '/', FakeBroker, False)
     os.mkdir('%s/tmp' % drive)
     old_file = '%s/tmp/old_file' % drive
     new_file = '%s/new_db_file' % drive
     try:
         fp = open(old_file, 'w')
         fp.write('void')
         fp.close
         resp = rpc.complete_rsync(drive, new_file, args)
         self.assertEquals(204, resp.status_int)
     finally:
         rmtree(drive)
Example #3
0
 def test_merge_syncs(self):
     rpc = db_replicator.ReplicatorRpc('/', '/', FakeBroker, False)
     fake_broker = FakeBroker()
     args = ('a', 'b')
     rpc.merge_syncs(fake_broker, args)
     self.assertEquals(fake_broker.args, (args[0], ))
Example #4
0
 def test_rsync_then_merge(self):
     rpc = db_replicator.ReplicatorRpc('/', '/', FakeBroker, False)
     rpc.rsync_then_merge('sda1', '/srv/swift/blah', ('a', 'b'))