def test_register_failure(mocker, SETTINGS, WORKERS):
SETTINGS.GITHUB_SECRET = 'notasecret'
from concurrent.futures import Future
future = Future()
future.set_exception(Exception())
register_webhook = mocker.patch(
'jenkins_epo.main.register_webhook',
CoroutineMock(return_value=[future]),
)
mocker.patch('jenkins_epo.main.WORKERS', WORKERS)
from jenkins_epo.main import register
with pytest.raises(SystemExit):
yield from register()
assert WORKERS.start.mock_calls
assert register_webhook.mock_calls
assert WORKERS.terminate.mock_calls
评论列表
文章目录