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
评论列表
文章目录