Skip to content

Commit 4011c51

Browse files
Jakujewebknjaz
andcommitted
tests: Try overriding local file with SCP
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
1 parent 4fe1125 commit 4011c51

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/unit/scp_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,17 @@ def test_copy_from_non_existent_remote_path(path_to_non_existent_src_file, ssh_s
7575
error_msg = '^Error receiving information about file:'
7676
with pytest.raises(LibsshSCPException, match=error_msg):
7777
ssh_scp.get(str(path_to_non_existent_src_file), os.devnull)
78+
79+
80+
@pytest.fixture
81+
def pre_existing_file_path(tmp_path):
82+
"""Return local path for a pre-populated file."""
83+
path = tmp_path / 'pre-existing-file.txt'
84+
path.write_bytes(b'whatever')
85+
return path
86+
87+
88+
def test_get_existing_local(pre_existing_file_path, src_path, ssh_scp, transmit_payload):
89+
"""Check that SCP file download works and overwrites local file if it exists."""
90+
ssh_scp.get(str(src_path), str(pre_existing_file_path))
91+
assert pre_existing_file_path.read_bytes() == transmit_payload

0 commit comments

Comments
 (0)