def test_markdown_link_to_pr(self, gh_api): self.init_github() pr = ShortPullRequest(self._get_expected_pull_request(1, 1), gh_api) actual_link = markdown_link_to_pr(pr) expected_link = f"{pr.title} [[PR{pr.number}]({pr.html_url})]" assert expected_link == actual_link
def render_empty_pr_section(empty_change_notes): section_lines = [] if empty_change_notes: section_lines.append("\n# Pull requests with no release notes") for change_note in empty_change_notes: section_lines.append("\n* {}".format(markdown_link_to_pr(change_note))) return section_lines
def test_markdown_link_to_pr(self, gh_api): self.init_github() pr = ShortPullRequest(self._get_expected_pull_request(1, 1), gh_api) actual_link = markdown_link_to_pr(pr) expected_link = "{} [[PR{}]({})]".format(pr.title, pr.number, pr.html_url) assert expected_link == actual_link
def _add_link_to_pr(self, to_update, to_link): """Updates pull request to_update with a link to pull request to_link if one does not already exist.""" body = to_update.body pull_request_link = markdown_link_to_pr(to_link) if pull_request_link not in body: body += "\r\n* " + pull_request_link to_update.update(body=body)