Пример #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