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
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)
def test_access(self): view = ReadOnlyView() with pytest.raises(FuseOSError): view.access("path", os.W_OK) assert view.access("path", os.R_OK) == 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