コード例 #1
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()
コード例 #2
0
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()
コード例 #3
0
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
コード例 #4
0
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
コード例 #5
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
コード例 #6
0
def _test_rmvcp_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)

        client.execute_command(cmd, f"{f1.name} {d1.name}")
        if move:
            assert not f1.exists()
        assert (d1 / f1.name).exists()
コード例 #7
0
def _test_mvcp_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)

        client.execute_command(cmd, f"{f1} {d1}")
        if move:
            assert not f1.exists()
        assert (d1 / f1.name).exists()
コード例 #8
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
コード例 #9
0
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()
コード例 #10
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()
コード例 #11
0
def test_mkdir():
    with tempfile.TemporaryDirectory() as tmp:
        d = tmpdir(tmp)

        client.execute_command(Commands.LOCAL_CREATE_DIRECTORY, str(d))
        assert d.exists()