def test_pr_commit_comment_callback(self, config):
"""Test that a snooze label is removed from PRs when a new commit is
pushed."""
responses.add(
responses.PATCH,
"https://api.github.com/repos/octocat/Hello-World/issues/1347")
responses.add(
responses.GET,
"https://api.github.com/repos/baxterthehacker/public-repo/issues/1",
body=github_responses.SNOOZED_ISSUE_GET)
r = snooze.github_callback(
"pull_request_review_comment",
json.loads(github_responses.PULL_REQUEST_REVIEW_COMMENT),
(config["github_username"], config["github_token"]),
config["snooze_label"],
config["ignore_members_of"])
assert r is True
assert len(responses.calls) == 2
org_url = "https://api.github.com/orgs/fellowship/members/baxterthehacker"
responses.add(responses.GET, org_url, status=204) # is a member
r = snooze.github_callback(
"pull_request_review_comment",
json.loads(github_responses.PULL_REQUEST_REVIEW_COMMENT),
(config["github_username"], config["github_token"]),
config["snooze_label"],
ignore_members_of="fellowship")
assert r is False
orc_url = "https://api.github.com/orgs/orcs/members/baxterthehacker"
responses.add(responses.GET, orc_url, status=404) # is not a member
r = snooze.github_callback(
"pull_request_review_comment",
json.loads(github_responses.PULL_REQUEST_REVIEW_COMMENT),
(config["github_username"], config["github_token"]),
config["snooze_label"],
ignore_members_of="orcs")
assert r is True
评论列表
文章目录