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')
评论列表
文章目录