def test_hrsync_one_host(self): h1 = self._gethostinfo() finished = [] rsync = HostRSync(self.source) h1.initgateway() rsync.add_target_host(h1) self.source.join("hello.py").write("world") rsync.send() assert self.dest.join("hello.py").check()
def test_hrsync_same_host_twice(self): h1 = self._gethostinfo() h2 = self._gethostinfo() finished = [] rsync = HostRSync(self.source) l = [] h1.initgateway() h2.initgateway() res1 = rsync.add_target_host(h1) assert res1 res2 = rsync.add_target_host(h2) assert not res2
def test_hrsync_localhost_inplace(self): h1 = HostInfo("localhost") events = [] rsync = HostRSync(self.source) h1.initgateway() rsync.add_target_host(h1, reporter=events.append) assert events l = [x for x in events if isinstance(x, repevent.HostRSyncing)] assert len(l) == 1 ev = l[0] assert ev.host == h1 assert ev.root == ev.remotepath l = [x for x in events if isinstance(x, repevent.HostRSyncRootReady)] assert len(l) == 1 ev = l[0] assert ev.root == self.source assert ev.host == h1