def test_issue_comment_callback(self, config):
"""Test that a snooze label is removed from issues when a new comment
is received."""
responses.add(
responses.PATCH,
"https://api.github.com/repos/baxterthehacker/public-repo/issues/2")
r = snooze.github_callback(
"issue_comment",
json.loads(github_responses.SNOOZED_ISSUE_COMMENT),
(config["github_username"], config["github_token"]),
config["snooze_label"],
config["ignore_members_of"])
assert r is True
assert len(responses.calls) == 1
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(
"issue_comment",
json.loads(github_responses.SNOOZED_ISSUE_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(
"issue_comment",
json.loads(github_responses.SNOOZED_ISSUE_COMMENT),
(config["github_username"], config["github_token"]),
config["snooze_label"],
ignore_members_of="orcs")
assert r is True
评论列表
文章目录