test_github_service.py 文件源码

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

项目:flash_services 作者: textbook 项目源码 文件源码
def test_update_enterprise_success(debug):
    responses.add(
        responses.GET,
        'http://dummy.url/repos/foo/bar/commits?access_token=foobar',
        json=[{'commit': {
            'author': {'name': 'alice'},
            'committer': {'name': 'bob', 'date': TWO_DAYS_AGO},
            'message': 'commit message',
        }}],
    )

    service = GitHubEnterprise(api_token='foobar', account='foo', repo='bar',
                               root='http://dummy.url')

    result = service.update()

    debug.assert_called_once_with('fetching GitHub project data')
    assert result == {'commits': [{
        'message': 'commit message',
        'author': 'alice [bob]',
        'committed': 'two days ago'
    }], 'name': 'foo/bar'}
    assert responses.calls[0].request.headers['User-Agent'] == 'bar'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号