From a30687125cd31152e23fa1cc0b5d728ce26342fe Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Jul 2023 12:12:29 +0530 Subject: [PATCH] Start on tests for receive kitten --- kitty_tests/file_transmission.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/kitty_tests/file_transmission.py b/kitty_tests/file_transmission.py index 549b18da6..52722c9b8 100644 --- a/kitty_tests/file_transmission.py +++ b/kitty_tests/file_transmission.py @@ -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: