Skip to content

Commit 70a90ca

Browse files
committed
tests: Adjust the SFTP tests to new chunk size
Signed-off-by: Jakub Jelen <[email protected]>
1 parent 0e9c2fd commit 70a90ca

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/unit/sftp_test.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,19 @@ def test_put_existing(dst_exists_path, src_path, sftp_session, transmit_payload)
9797

9898
@pytest.fixture
9999
def large_payload():
100-
"""Generate a large 1025 byte (1024 + 1B) test payload."""
101-
payload_len = 1024 + 1
102-
random_bytes = [ord(random.choice(string.printable)) for _ in range(payload_len)]
103-
return bytes(random_bytes)
100+
"""Generate a large 32769 byte (32kB + 1B) test payload."""
101+
random_char_kilobyte = [ord(random.choice(string.printable)) for _ in range(1024)]
102+
full_bytes_number = 32
103+
a_32kB_chunk = bytes(random_char_kilobyte * full_bytes_number)
104+
the_last_byte = random.choice(random_char_kilobyte).to_bytes(length=1, byteorder='big')
105+
return a_32kB_chunk + the_last_byte
104106

105107

106108
@pytest.fixture
107109
def src_path_large(tmp_path, large_payload):
108-
"""Return a remote path to a 1025 byte-sized file.
110+
"""Return a remote path to a 32769 byte-sized file.
109111
110-
The pylibssh chunk size is 1024 so the test needs a file that would
112+
The pylibssh chunk size is 32769 so the test needs a file that would
111113
execute at least two loops.
112114
"""
113115
path = tmp_path / 'large.txt'

0 commit comments

Comments
 (0)