Start on tests for receive kitten
This commit is contained in:
parent
2cae0ab695
commit
a30687125c
1 changed files with 9 additions and 16 deletions
|
|
@ -313,9 +313,6 @@ def c(k, v):
|
|||
t('a1=b1;c=d;;e', 'a1', 'b1', 'c', 'd')
|
||||
t('a1=b1;c=d;;;1=1', 'a1', 'b1', 'c', 'd', '1', '1')
|
||||
|
||||
def test_path_mapping_receive(self):
|
||||
self.skipTest('TODO: Port this test')
|
||||
|
||||
def test_rsync_hashers(self):
|
||||
h = Hasher("xxh3-64")
|
||||
h.update(b'abcd')
|
||||
|
|
@ -343,8 +340,7 @@ def run_kitten(self, cmd, home_dir='', allow=True):
|
|||
if os.path.exists(cwd):
|
||||
shutil.rmtree(cwd)
|
||||
|
||||
def test_transfer_receive(self):
|
||||
self.direction_receive = True
|
||||
def basic_transfer_tests(self):
|
||||
src = os.path.join(self.tdir, 'src')
|
||||
self.src_data = os.urandom(11113)
|
||||
with open(src, 'wb') as s:
|
||||
|
|
@ -354,17 +350,6 @@ def test_transfer_receive(self):
|
|||
pty.wait_till_child_exits(require_exit_code=1)
|
||||
self.assertFalse(os.path.exists(dest))
|
||||
|
||||
def test_transfer_send(self):
|
||||
src = os.path.join(self.tdir, 'src')
|
||||
self.src_data = os.urandom(9137)
|
||||
with open(src, 'wb') as s:
|
||||
s.write(self.src_data)
|
||||
dest = os.path.join(self.tdir, 'dest')
|
||||
|
||||
with self.run_kitten([src, dest], allow=False) as pty:
|
||||
pty.wait_till_child_exits(require_exit_code=1)
|
||||
self.assertFalse(os.path.exists(dest))
|
||||
|
||||
def single_file(*cmd):
|
||||
with self.run_kitten(list(cmd) + [src, dest]) as pty:
|
||||
pty.wait_till_child_exits(require_exit_code=0)
|
||||
|
|
@ -383,6 +368,14 @@ def single_file(*cmd):
|
|||
single_file('--compress=always')
|
||||
single_file('--transmit-deltas', '--compress=never')
|
||||
|
||||
def test_transfer_receive(self):
|
||||
self.direction_receive = True
|
||||
self.basic_transfer_tests()
|
||||
|
||||
def test_transfer_send(self):
|
||||
self.basic_transfer_tests()
|
||||
src = os.path.join(self.tdir, 'src')
|
||||
|
||||
# remote home
|
||||
fname = 'tstest-file'
|
||||
with set_paths(home=self.tdir), self.run_kitten([src, '~/'+fname]) as pty:
|
||||
|
|
|
|||
Loading…
Reference in a new issue