summaryrefslogtreecommitdiff
path: root/test/test_e2e.py
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2023-08-04 14:04:46 +0900
committerRyo Nakamura <upa@haeena.net>2023-08-04 14:04:46 +0900
commit2773c7b4d63677c4a1801960af13cbd4fdbeb493 (patch)
treea4be064a8060e3c20f0416a9d867c913ac98da37 /test/test_e2e.py
parent518aa42208969566aa26cf82a40d1ecb6358684a (diff)
add test for specifying ssh_config
Diffstat (limited to 'test/test_e2e.py')
-rw-r--r--test/test_e2e.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/test_e2e.py b/test/test_e2e.py
index 1e75f61..841c3be 100644
--- a/test/test_e2e.py
+++ b/test/test_e2e.py
@@ -237,3 +237,41 @@ def test_compression(mscp, src_prefix, dst_prefix, compress):
assert check_same_md5sum(src, dst)
src.cleanup()
dst.cleanup()
+
+
+testhost = "mscptestlocalhost"
+testhost_prefix = "{}:{}/".format(testhost, os.getcwd()) # use current dir
+param_testhost_prefix = [
+ ("", testhost_prefix), (testhost_prefix, "")
+]
+@pytest.mark.parametrize("src_prefix, dst_prefix", param_testhost_prefix)
+def test_config_ok(mscp, src_prefix, dst_prefix):
+ config = "/tmp/mscp_test_ssh_config"
+ with open(config, "w") as f:
+ f.write("host {}\n".format(testhost))
+ f.write(" hostname localhost\n")
+
+ src = File("src", size = 1024 * 1024).make()
+ dst = File("dst", size = 1024 * 1024 * 2).make()
+ run2ok([mscp, "-H", "-vvv", "-F", config,
+ src_prefix + src.path, dst_prefix + "dst"])
+
+ os.remove(config)
+ assert check_same_md5sum(src, dst)
+ src.cleanup()
+ dst.cleanup()
+
+@pytest.mark.parametrize("src_prefix, dst_prefix", param_testhost_prefix)
+def test_config_ng(mscp, src_prefix, dst_prefix):
+ config = "/tmp/mscp_test_ssh_config"
+ with open(config, "w") as f:
+ f.write("\n") # use empty ssh_config
+
+ src = File("src", size = 1024 * 1024).make()
+ dst = File("dst", size = 1024 * 1024 * 2).make()
+ run2ng([mscp, "-H", "-vvv", "-F", config,
+ src_prefix + src.path, dst_prefix + "dst"])
+
+ os.remove(config)
+ src.cleanup()
+ dst.cleanup()