async def get_info_md_content(repository):
    """Get the content of info.md"""
    filename = info_file(repository)
    if not filename:
        return ""
    try:
        info = await repository.repository_object.get_contents(
            filename, repository.ref)
        if info is None:
            return ""
        info = info.content.replace("<svg", "<disabled").replace(
            "</svg", "</disabled")
        return render_template(info, repository)
    except (AIOGitHubAPIException, Exception):  # pylint: disable=broad-except
        if repository.hacs.action:
            raise HacsException("::error:: No info file found")
    return ""
Example #2
0
def test_render_template():
    repository = dummy_repository_base()
    content = "ABC"
    render_template(content, repository)
    repository.releases.last_release_object = MockRelease()
    render_template(content, repository)