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""
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") == ""
def test_permissions(backend): c = Client(connection=backend()) c.rm(b"/foo") c.mkdir(b"/foo/bar") # a) checking default permissions -- full access. assert c.get_permissions(b"/foo/bar") == [b"n0"] # b) setting new permissions, and making sure it worked. c.set_permissions(b"/foo/bar", [b"b0"]) assert c.get_permissions(b"/foo/bar") == [b"b0"] # c) conflicting permissions -- XenStore doesn't care. c.set_permissions(b"/foo/bar", [b"b0", b"n0", b"r0"]) assert c.get_permissions(b"/foo/bar") == [b"b0", b"n0", b"r0"] # d) invalid permission format. with pytest.raises(InvalidPermission): c.set_permissions(b"/foo/bar", [b"x0"])
def test_permissions(): for backend in [UnixSocketConnection, XenBusConnection]: c = Client(connection=backend()) c.rm("/foo") c.mkdir("/foo/bar") # a) checking default permissions -- full access. assert c.get_permissions("/foo/bar") == ["n0"] # b) setting new permissions, and making sure it worked. c.set_permissions("/foo/bar", ["b0"]) assert c.get_permissions("/foo/bar") == ["b0"] # c) conflicting permissions -- XenStore doesn't care. c.set_permissions("/foo/bar", ["b0", "n0", "r0"]) assert c.get_permissions("/foo/bar") == ["b0", "n0", "r0"] # d) invalid permission format. with pytest.raises(InvalidPermission): c.set_permissions("/foo/bar", ["x0"])
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") == ""