def test_fsync_a_file_from_git_dir(self): current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", ignore=CachedIgnore()) with pytest.raises(FuseOSError): current.fsync(".git/", "data", 0)
def test_fsync(self): from gitfs.views import current as current_view old_fsync = current_view.PassthroughView.fsync current_view.PassthroughView.fsync = lambda me, path, data, fh: "done" mocked_index = MagicMock() current = CurrentView(repo="repo", uid=1, gid=1, repo_path="repo_path", ignore=CachedIgnore()) current._stage = mocked_index assert current.fsync("/path", "data", 1) == "done" message = "Fsync /path" mocked_index.assert_called_once_with(add="/path", message=message) current_view.PassthroughView.fsync = old_fsync