Esempio n. 1
0
def test_rm(backend):
    c = Client(connection=backend())
    c.mkdir(b"/foo/bar")
    c.rm(b"/foo/bar")

    with pytest.raises(PyXSError):
        c.read(b"/foo/bar")

    c.read(b"/foo/bar", b"baz") == b"baz"  # using a default option.

    assert c.read(b"/foo") == b""
Esempio n. 2
0
def test_client_read(backend):
    c = Client(connection=backend())

    # a) non-existant path.
    try:
        c.read(b"/foo/bar")
    except PyXSError as e:
        assert e.args[0] == errno.ENOENT

    # b) OK-case (`/local` is allways in place).
    assert c.read("/local") == b""
    assert c["/local"] == b""
Esempio n. 3
0
File: tests.py Progetto: brkt/pyxs
def test_client_read():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())

        # a) non-existant path.
        try:
            c.read("/foo/bar")
        except PyXSError as e:
            assert e.args[0] is errno.ENOENT

        # b) OK-case (`/local` is allways in place).
        assert c.read("/local") == ""
        assert c["/local"] == ""
Esempio n. 4
0
def test_client_read():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())

        # a) non-existant path.
        try:
            c.read("/foo/bar")
        except PyXSError as e:
            assert e.args[0] is errno.ENOENT

        # b) OK-case (`/local` is allways in place).
        assert c.read("/local") == ""
        assert c["/local"] == ""
Esempio n. 5
0
def test_rm():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())
        c.mkdir("/foo/bar")

        try:
            c.rm("/foo/bar")
        except PyXSError as e:
            pytest.fail("No error should've been raised, got: {0}".format(e))

        with pytest.raises(PyXSError):
            c.read("/foo/bar")

        assert c.read("/foo") == ""
Esempio n. 6
0
File: tests.py Progetto: brkt/pyxs
def test_mkdir():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())

        c.mkdir("/foo/bar")
        assert c.ls("/foo") == ["bar"]
        assert c.read("/foo/bar") == ""
Esempio n. 7
0
def test_mkdir():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())

        c.mkdir("/foo/bar")
        assert c.ls("/foo") == ["bar"]
        assert c.read("/foo/bar") == ""
Esempio n. 8
0
def test_write(backend):
    c = Client(connection=backend())

    c.write(b"/foo/bar", b"baz")
    assert c.read(b"/foo/bar") == b"baz"

    c[b"/foo/bar"] = b"boo"
    assert c[b"/foo/bar"] == b"boo"
Esempio n. 9
0
File: tests.py Progetto: brkt/pyxs
def test_write():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())

        c.write("/foo/bar", "baz")
        assert c.read("/foo/bar") == "baz"

        c["/foo/bar"] = "boo"
        assert c["/foo/bar"] == "boo"
Esempio n. 10
0
def test_write():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())

        c.write("/foo/bar", "baz")
        assert c.read("/foo/bar") == "baz"

        c["/foo/bar"] = "boo"
        assert c["/foo/bar"] == "boo"
Esempio n. 11
0
def test_rm():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())
        c.mkdir("/foo/bar")

        try:
            c.rm("/foo/bar")
        except PyXSError as e:
            pytest.fail("No error should've been raised, got: {0}"
                        .format(e))

        with pytest.raises(PyXSError):
            c.read("/foo/bar")

        try:
            c.read("/foo/bar", "baz") == "baz"  # using a default option.
        except PyXSError:
            pytest.fail("No error should've been raised, got: {0}"
                        .format(e))

        assert c.read("/foo") == ""
Esempio n. 12
0
def test_mkdir(backend):
    c = Client(connection=backend())

    c.mkdir(b"/foo/bar")
    assert c.ls(b"/foo") == [b"bar"]
    assert c.read(b"/foo/bar") == b""