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_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()
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_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
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_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()
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()
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_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_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_mkdir(): with tempfile.TemporaryDirectory() as tmp: d = tmpdir(tmp) client.execute_command(Commands.LOCAL_CREATE_DIRECTORY, str(d)) assert d.exists()