示例#1
0
    def test_always_return_0(self):
        view = ReadOnlyView()

        for method in ["flush", "releasedir", "release"]:
            assert getattr(view, method)("path", 1) == 0

        assert view.opendir("path") == 0
示例#2
0
    def test_always_return_0(self):
        view = ReadOnlyView()

        for method in ["flush", "releasedir", "release"]:
            assert getattr(view, method)("path", 1) == 0

        assert view.opendir("path") == 0
示例#3
0
    def test_cant_write(self):
        view = ReadOnlyView()

        for method in ["write", "create", "utimens",
                       "chmod", "mkdir"]:
            with pytest.raises(FuseOSError):
                getattr(view, method)("path", 1)

        with pytest.raises(FuseOSError):
            view.getxattr("path", "name", 1)

        with pytest.raises(FuseOSError):
            view.chown("path", 1, 1)
示例#4
0
    def test_cant_write(self):
        view = ReadOnlyView()

        for method in ["write", "create", "utimens", "chmod", "mkdir"]:
            with pytest.raises(FuseOSError):
                getattr(view, method)("path", 1)

        with pytest.raises(FuseOSError):
            view.getxattr("path", "name", 1)

        with pytest.raises(FuseOSError):
            view.chown("path", 1, 1)
示例#5
0
    def test_access(self):
        view = ReadOnlyView()

        with pytest.raises(FuseOSError):
            view.access("path", os.W_OK)
        assert view.access("path", os.R_OK) == 0
示例#6
0
    def test_open(self):
        view = ReadOnlyView()

        with pytest.raises(FuseOSError):
            view.open("path", os.O_WRONLY)
        assert view.open("path", os.O_RDONLY) == 0
示例#7
0
    def test_access(self):
        view = ReadOnlyView()

        with pytest.raises(FuseOSError):
            view.access("path", os.W_OK)
        assert view.access("path", os.R_OK) == 0
示例#8
0
    def test_open(self):
        view = ReadOnlyView()

        with pytest.raises(FuseOSError):
            view.open("path", os.O_WRONLY)
        assert view.open("path", os.O_RDONLY) == 0