test_github.py 文件源码

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

项目:artman 作者: googleapis 项目源码 文件源码
def test_with_ssh_repo(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(**self.task_kwargs)

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

        # Assert that the correct methods were called.
        login.assert_called_once_with('lukesneeringer', '1335020400')
        gh.repository.assert_called_with('me', 'repo')
        gh.repository().create_pull.assert_called_once_with(
            base='master',
            body='This pull request was generated by artman. '
                 'Please review it thoroughly before merging.',
            head='pubsub-python-v1',
            title='Python GAPIC: Pubsub v1',
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号