Exemple #1
0
def _test_mvcp_multiple_file_into_nothing(move: bool): # illegal
    cmd = Commands.LOCAL_MOVE if move else Commands.LOCAL_COPY

    with tempfile.TemporaryDirectory() as tmp:
        d0 = tmpdir(tmp, create=False)
        f1 = tmpfile(tmp)
        f2 = tmpfile(tmp)

        ret = client.execute_command(cmd, f"{f1} {f2} {d0}")
        assert ret != ClientErrors.SUCCESS
def _test_mvcp_multiple_file_into_nothing(move: bool):  # illegal
    with EsConnectionTest(esd.sharing_root.name) as client:
        cmd = Commands.REMOTE_MOVE if move else Commands.REMOTE_COPY

        d0 = tmpdir(esd.sharing_root, create=False)
        f1 = tmpfile(esd.sharing_root)
        f2 = tmpfile(esd.sharing_root)

        ret = client.execute_command(cmd, f"{f1.name} {f2.name} {d0.name}")
        assert ret != ClientErrors.SUCCESS
def _test_rmvcp_rename(move: bool):
    with EsConnectionTest(esd.sharing_root.name) as client:
        cmd = Commands.REMOTE_MOVE if move else Commands.REMOTE_COPY

        f1 = tmpfile(esd.sharing_root)
        f2 = tmpfile(esd.sharing_root, create=False)
        client.execute_command(cmd, f"{f1.name} {f2.name}")

        if move:
            assert not f1.exists()
        assert f2.exists()
Exemple #4
0
def _test_mvcp_rename(move: bool):
    cmd = Commands.LOCAL_MOVE if move else Commands.LOCAL_COPY

    with tempfile.TemporaryDirectory() as tmp:
        f1 = tmpfile(tmp)
        f2 = tmpfile(tmp, create=False)
        client.execute_command(cmd, f"{f1} {f2}")

        if move:
            assert not f1.exists()
        assert f2.exists()
def test_rrm_multiple():
    with EsConnectionTest(esd.sharing_root.name) as client:
        f1 = tmpfile(esd.sharing_root)

        d1 = tmpdir(esd.sharing_root)
        f2 = tmpfile(d1)
        f3 = tmpfile(d1)

        client.execute_command(Commands.REMOTE_REMOVE, f"{f1.name} {d1.name}")
        assert not d1.exists()
        assert not f1.exists()
        assert not f2.exists()
        assert not f3.exists()
def _test_mvcp_multiple_file_into_file(move: bool):  # illegal
    with EsConnectionTest(esd.sharing_root.name) as client:
        cmd = Commands.REMOTE_MOVE if move else Commands.REMOTE_COPY

        f0 = tmpfile(esd.sharing_root)
        f1 = tmpfile(esd.sharing_root)
        f2 = tmpfile(esd.sharing_root)

        try:
            client.execute_command(cmd, f"{f1.name} {f2.name} {f0.name}")
            assert False
        except:
            pass
Exemple #7
0
def test_rm_multiple():
    with tempfile.TemporaryDirectory() as tmp:
        f1 = tmpfile(tmp)

        d1 = tmpdir(tmp)
        f2 = tmpfile(d1)
        f3 = tmpfile(d1)

        client.execute_command(Commands.LOCAL_REMOVE, f"{f1} {d1}")
        assert not d1.exists()
        assert not f1.exists()
        assert not f2.exists()
        assert not f3.exists()
def _test_rmvcp_multiple_file_into_dir(move: bool):
    with EsConnectionTest(esd.sharing_root.name) as client:
        cmd = Commands.REMOTE_MOVE if move else Commands.REMOTE_COPY

        d1 = tmpdir(esd.sharing_root)
        f1 = tmpfile(esd.sharing_root)
        f2 = tmpfile(esd.sharing_root)

        client.execute_command(cmd, f"{f1.name} {f2.name} {d1.name}")
        if move:
            assert not f1.exists()
            assert not f2.exists()
        assert (d1 / f1.name).exists()
        assert (d1 / f2.name).exists()
Exemple #9
0
def _test_mvcp_multiple_file_into_dir(move: bool):
    cmd = Commands.LOCAL_MOVE if move else Commands.LOCAL_COPY

    with tempfile.TemporaryDirectory() as tmp:
        d1 = tmpdir(tmp)
        f1 = tmpfile(tmp)
        f2 = tmpfile(tmp)

        client.execute_command(cmd, f"{f1} {f2} {d1}")
        if move:
            assert not f1.exists()
            assert not f2.exists()
        assert (d1 / f1.name).exists()
        assert (d1 / f2.name).exists()
def test_rrm_nested():
    with EsConnectionTest(esd.sharing_root.name) as client:
        d1 = tmpdir(esd.sharing_root)
        f1 = tmpfile(d1)

        client.execute_command(Commands.REMOTE_REMOVE, d1.name)
        assert not d1.exists()
        assert not f1.exists()
Exemple #11
0
def test_rm_nested():
    with tempfile.TemporaryDirectory() as tmp:
        d1 = tmpdir(tmp)
        f1 = tmpfile(d1)

        client.execute_command(Commands.LOCAL_REMOVE, str(d1))
        assert not d1.exists()
        assert not f1.exists()
def _test_rmvcp_dir_into_file(move: bool):  # illegal
    with EsConnectionTest(esd.sharing_root.name) as client:
        cmd = Commands.REMOTE_MOVE if move else Commands.REMOTE_COPY

        d1 = tmpdir(esd.sharing_root)
        f1 = tmpfile(esd.sharing_root)

        ret = client.execute_command(cmd, f"{d1.name} {f1.name}")
        print(f"ret = {ret}")
        assert ret != ClientErrors.SUCCESS
Exemple #13
0
def _test_mvcp_dir_into_file(move: bool): # illegal
    cmd = Commands.LOCAL_MOVE if move else Commands.LOCAL_COPY

    with tempfile.TemporaryDirectory() as tmp:
        d1 = tmpdir(tmp)
        f1 = tmpfile(tmp)

        try:
            client.execute_command(cmd, f"{d1} {f1}")
            assert False
        except:
            pass
def test_rrm_single():
    with EsConnectionTest(esd.sharing_root.name) as client:
        f = tmpfile(esd.sharing_root)
        client.execute_command(Commands.REMOTE_REMOVE, f.name)
        assert not f.exists()
Exemple #15
0
def test_rm_single():
    with tempfile.TemporaryDirectory() as tmp:
        f1 = tmpfile(tmp)

        client.execute_command(Commands.LOCAL_REMOVE, str(f1))
        assert not f1.exists()