def test_write_in_modules_dir(self): with pytest.raises(FuseOSError): current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", read_only=Event(), ignore=CachedIgnore()) current.write(".gitmodules", "buf", "offset", 1)
def test_write_to_large_file(self): current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", read_only=Event(), ignore=CachedIgnore()) current.max_size = 10 current.dirty = {'/path': {'size': 5}} with pytest.raises(FuseOSError): current.write("/path", "bufffffert", 11, 1)
def test_write_to_large_file(self): current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", read_only=Event(), ignore=CachedIgnore()) current.max_size = 10 current.dirty = { '/path': { 'size': 5 } } with pytest.raises(FuseOSError): current.write("/path", "bufffffert", 11, 1)
def test_write(self): from gitfs.views import current as current_view mocked_write = lambda self, path, buf, offste, fh: "done" old_write = current_view.PassthroughView.write current_view.PassthroughView.write = mocked_write current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", read_only=Event(), ignore=CachedIgnore()) current.max_offset = 20 current.max_size = 20 current.dirty = {1: {}} assert current.write("/path", "buf", 3, 1) == "done" assert current.dirty == {1: {'message': 'Update /path', 'stage': True}} current_view.PassthroughView.write = old_write
def test_write(self): from gitfs.views import current as current_view mocked_write = lambda self, path, buf, offste, fh: "done" old_write = current_view.PassthroughView.write current_view.PassthroughView.write = mocked_write current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", read_only=Event(), ignore=CachedIgnore()) current.max_offset = 20 current.max_size = 20 current.dirty = { 1: {} } assert current.write("/path", "buf", 3, 1) == "done" assert current.dirty == { 1: { 'message': 'Update /path', } } current_view.PassthroughView.write = old_write