def test_merge_fail():
from jenkins_epo.extensions.core import MergerExtension, ApiError
ext = MergerExtension('merger', Mock())
ext.current = Mock()
ext.current.SETTINGS.COLLABORATORS = ['collaborator']
ext.current.last_commit.date = datetime.now()
ext.current.opm.author = 'collaborator'
ext.current.opm_denied = []
ext.current.wip = None
ext.current.last_commit.fetch_combined_status = CoroutineMock(
return_value={'state': 'success'}
)
ext.current.head.merge.side_effect = ApiError('url', {}, dict(
code=405, json=dict(message="error")
))
yield from ext.run()
assert not ext.current.head.delete_branch.mock_calls
评论列表
文章目录