def test_report_status_by_comment( project, commit_sha, pr_id, state, check_names, url, result, ): reporter = StatusReporter(project, commit_sha, pr_id) comment_body = "\n".join(( "| Job | Result |", "| ------------- | ------------ |", f"| [{check_names}]({url}) | {result} |", )) if pr_id: project.should_receive("get_pr").with_args(pr_id=pr_id).and_return( flexmock().should_receive("comment").with_args( body=comment_body).mock()).once() else: project.should_receive("commit_comment").with_args( commit=commit_sha, body=comment_body, ).once() reporter.report_status_by_comment(state, url, check_names)
def test_report_status_by_comment( project, commit_sha, pr_id, pr_object, state, description, check_names, url, ): reporter = StatusReporter(project, commit_sha, pr_id) project.should_receive("pr_comment").with_args( pr_id, f"| [{check_names}]({url}) | SUCCESS |" ).once() reporter.report_status_by_comment(state, url, check_names)