test_main.py 文件源码

python
阅读 42 收藏 0 点赞 0 评论 0

项目:jenkins-epo 作者: peopledoc 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号