Esempio n. 1
0
def test_transaction_with_cache(ftp_writable, tmpdir):
    host, port, user, pw = ftp_writable
    fs = FTPFileSystem(host, port, user, pw)
    fs.mkdir("/tmp")
    fs.mkdir("/tmp/dir")
    assert "dir" in fs.ls("/tmp", detail=False)

    with fs.transaction:
        fs.rmdir("/tmp/dir")

    assert "dir" not in fs.ls("/tmp", detail=False)
    assert not fs.exists("/tmp/dir")
Esempio n. 2
0
def test_basic(ftp):
    host, port = ftp
    fs = FTPFileSystem(host, port)
    assert fs.ls('/', detail=False) == sorted(
        ['/' + f for f in os.listdir(here)])
    out = fs.cat('/' + os.path.basename(__file__))
    assert out == open(__file__, 'rb').read()
Esempio n. 3
0
def test_basic(ftp):
    host, port = ftp
    fs = FTPFileSystem(host, port)
    assert fs.ls("/", detail=False) == sorted(os.listdir(here))
    out = fs.cat("/" + os.path.basename(__file__))
    assert out == open(__file__, "rb").read()