test_callbacks.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:github-snooze-button 作者: tdsmith 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号