예제 #1
0
def _sync(
        password=False, fix=False,
        exclude=None, ssh_agent=False,
        delete=True

):
    """Launch sync and do basic comparison of dir trees."""
    if not password:
        remote = '[email protected]:' + '/' + REMOTE_FOLDER
    else:
        remote = 'test:[email protected]:' + '/' + REMOTE_FOLDER

    sync = SFTPClone(
        LOCAL_FOLDER,
        remote,
        port=2222,
        fix_symlinks=fix,
        identity_files=[t_path("id_rsa")],
        exclude_file=exclude,
        ssh_agent=ssh_agent,
        delete=delete
    )
    sync.run()

    if not exclude and delete:
        # check the directory trees
        assert \
            file_tree(
                LOCAL_FOLDER
            )[LOCAL_FOLDER_NAME] == file_tree(
                REMOTE_PATH
            )[REMOTE_FOLDER]
예제 #2
0
def _sync(password=False,
          fix=False,
          exclude=None,
          ssh_agent=False,
          delete=True):
    """Launch sync and do basic comparison of dir trees."""
    if not password:
        remote = '[email protected]:' + '/' + REMOTE_FOLDER
    else:
        remote = 'test:[email protected]:' + '/' + REMOTE_FOLDER

    sync = SFTPClone(LOCAL_FOLDER,
                     remote,
                     port=2222,
                     fix_symlinks=fix,
                     identity_files=[t_path("id_rsa")],
                     exclude_file=exclude,
                     ssh_agent=ssh_agent,
                     delete=delete)
    sync.run()

    if not exclude and delete:
        # check the directory trees
        assert \
            file_tree(
                LOCAL_FOLDER
            )[LOCAL_FOLDER_NAME] == file_tree(
                REMOTE_PATH
            )[REMOTE_FOLDER]
예제 #3
0
def test_remote_tilde_home():
    """Test tilde expansion on remote end."""
    normal_files = ("bar", "bis")  # just to add noise
    for f in normal_files:
        os.open(join(LOCAL_FOLDER, f), os.O_CREAT)
        os.open(join(REMOTE_PATH, f), os.O_CREAT)

    sync = SFTPClone(
        LOCAL_FOLDER,
        remote_url='[email protected]:' + '~' + REMOTE_FOLDER,
        port=2222,
        identity_files=[t_path("id_rsa"), ]
    )
    sync.run()

    assert file_tree(LOCAL_FOLDER)[LOCAL_FOLDER_NAME] == file_tree(REMOTE_PATH)[REMOTE_FOLDER]