def mock_get_branch(mocker, commit_id):
    """Mock the get_branch method of VersionControlMixin class.

    Arguments:
        mocker: The mocker fixture.
        commit_id: The commit id of the branch.

    Returns:
        The patched mocker and response data.

    """
    response_data = Branch.loads({
        "name": DEFAULT_BRANCH,
        "commitId": commit_id,
        "parentCommitId": "",
        "title": "test_draft",
        "description": "",
        "committer": {
            "name": "",
            "date": 1632454975
        },
    })
    return (
        mocker.patch(f"{version.__name__}.VersionControlMixin.get_branch",
                     return_value=response_data),
        response_data,
    )
    def test_loads(self):
        branch = Branch.loads(_BRANCH_DATA)
        assert branch.commit_id == ROOT_COMMIT_ID
        assert branch.name == _BRANCH_DATA["name"]

        with pytest.raises(AttributeError):
            branch.parent_commit_id
        with pytest.raises(AttributeError):
            branch.title
        with pytest.raises(AttributeError):
            branch.description
        with pytest.raises(AttributeError):
            branch.committer
    def _generate_branches(
        self, name: Optional[str] = None, offset: int = 0, limit: int = 128
    ) -> Generator[Branch, None, int]:
        params: Dict[str, Any] = {"offset": offset, "limit": limit}
        if name:
            params["name"] = name

        response = self._client.open_api_do(
            "GET", "branches", self._dataset_id, params=params
        ).json()

        for item in response["branches"]:
            yield Branch.loads(item)

        return response["totalCount"]  # type: ignore[no-any-return]