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