test_pull_request_checker.py 文件源码

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

项目:astropy-bot 作者: astropy 项目源码 文件源码
def setup_method(self, method):

        # Closed PR already tested in TestHook.test_invalid()
        pr_json = {'state': 'open',
                   'user': {'login': 'user'},
                   'head': {'repo': {'full_name': 'repo'},
                            'ref': 'branch'}}

        self.patch_repo_config = patch.object(RepoHandler, 'get_config_value')
        self.patch_pr_json = patch.object(
            PullRequestHandler, 'json', new_callable=PropertyMock,
            return_value=pr_json)
        self.patch_pr_comments = patch.object(
            PullRequestHandler, 'find_comments', return_value=[])
        self.patch_pr_labels = patch.object(
            PullRequestHandler, 'labels', new_callable=PropertyMock)
        self.patch_submit_comment = patch.object(
            PullRequestHandler, 'submit_comment', return_value='url')
        self.patch_set_status = patch.object(PullRequestHandler, 'set_status')
        self.patch_check_changelog = patch('changebot.blueprints.pull_request_checker.check_changelog_consistency')

        self.changelog_cfg = self.patch_repo_config.start()
        self.patch_pr_json.start()
        self.comment_ids = self.patch_pr_comments.start()
        self.labels = self.patch_pr_labels.start()
        self.submit_comment = self.patch_submit_comment.start()
        self.set_status = self.patch_set_status.start()
        self.issues = self.patch_check_changelog.start()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号