mirror of
https://github.com/upa/mscp.git
synced 2026-05-13 13:57:30 +08:00
@@ -9,6 +9,7 @@ import getpass
|
|||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from subprocess import check_call, CalledProcessError
|
from subprocess import check_call, CalledProcessError
|
||||||
@@ -629,6 +630,41 @@ def test_specify_invalid_password_via_env(mscp):
|
|||||||
run2ng([mscp, "-vvv", "-l", "test",
|
run2ng([mscp, "-vvv", "-l", "test",
|
||||||
src.path, "localhost:" + dst.path], env = env)
|
src.path, "localhost:" + dst.path], env = env)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def move_pubkey_temporally():
|
||||||
|
"""
|
||||||
|
mv ~/.ssh/id_* to id_rsa.bak before test, and move it back after test.
|
||||||
|
"""
|
||||||
|
|
||||||
|
sshdir = os.path.join(os.environ["HOME"], ".ssh")
|
||||||
|
|
||||||
|
# move pubkeys to /tmp
|
||||||
|
moved = []
|
||||||
|
for fname in os.listdir(sshdir):
|
||||||
|
if re.match(r"^id_[a-z0-9]+$", fname):
|
||||||
|
moved.append(fname)
|
||||||
|
shutil.move(f"{sshdir}/{fname}", f"/tmp/{fname}")
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
# move back the keys
|
||||||
|
for fname in moved:
|
||||||
|
shutil.move(f"/tmp/{fname}", f"{sshdir}/{fname}")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix)
|
||||||
|
def test_passwordauth_without_pubkey(move_pubkey_temporally,
|
||||||
|
mscp, src_prefix, dst_prefix):
|
||||||
|
"""
|
||||||
|
make sure password auth works (by removing publick keys)
|
||||||
|
"""
|
||||||
|
src = File("src", size = 10 * 1024 * 1024).make()
|
||||||
|
dst = File("dst")
|
||||||
|
run2ok([mscp, "-vvv", src_prefix + src.path, dst_prefix + dst.path])
|
||||||
|
assert check_same_md5sum(src, dst)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix)
|
@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix)
|
||||||
def test_10k_files(mscp, src_prefix, dst_prefix):
|
def test_10k_files(mscp, src_prefix, dst_prefix):
|
||||||
srcs = []
|
srcs = []
|
||||||
|
|||||||
Reference in New Issue
Block a user