def test__handle_synchronize__when_handle_pr_sync_raises_exception__handle_labeled_sync_should_be_called_anyway(self):
hook_data = {'pull_request': {'number': 12, 'head': {'repo': {'full_name': 'repo'}}}}
pr_labels = ['label1', 'label2']
github_controller = GithubController(mock(), mock(), mock(), mock())
# expect
expect(github_controller, times=1).get_pr_labels(repository='repo', pr_number=12).thenReturn(pr_labels)
expect(github_controller, times=1).handle_pr_sync(hook_data, pr_labels).thenRaise(GithubException(404, 'PR not found'))
expect(github_controller, times=1).handle_labeled_sync(hook_data, pr_labels).thenReturn(async_value(None))
# when
with pytest.raises(GithubException):
await github_controller.handle_synchronize(hook_data)
评论列表
文章目录