test_github.py 文件源码

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

项目:artman 作者: googleapis 项目源码 文件源码
def test_with_http_url(self, login):
        # Set up test data to return when we attempt to make the
        # pull request.
        gh = mock.MagicMock(spec=github3.github.GitHub)
        login.return_value = gh
        url = 'https://github.com/me/repo/pulls/1/'
        gh.repository().create_pull.return_value = Namespace(html_url=url)

        # Run the task.
        task = github.CreateGitHubPullRequest()
        pr = task.execute(**dict(self.task_kwargs, git_repo={
            'location': 'https://github/me/repo/',
        }))

        # Assert we got the correct result.
        assert pr.html_url == url

        # Assert that the correct repository method was still called.
        gh.repository.assert_called_with('me', 'repo')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号