test_core.py 文件源码

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

项目:travieso 作者: wizeline 项目源码 文件源码
def test_notify_gihub(faker):
    repo = {'owner_name': faker.domain_word(), 'name': faker.domain_word()}
    commit = uuid4().hex
    state = random.choice(['success', 'failure', 'error', 'pending']),
    job_task = faker.domain_word()
    job_id = random.randint(1, 10000)

    request_json = {
        'state': state,
        'target_url': 'https://travis-ci/{0}/{1}/jobs/{2}'.format(repo['owner_name'], repo['name'], job_id),
        'description': get_description_from_task(job_task),
        'context': job_task
    }

    responses.add(
        responses.POST,
        'https://api.github.com/repos/{0}/{1}/statuses/{2}'.format(repo['owner_name'], repo['name'], commit),
        json=request_json)

    notify_github(repo, commit, state, job_task, job_id)

    assert len(responses.calls) == 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号