test_collections.py 文件源码

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

项目:python-twitch-client 作者: tsifrer 项目源码 文件源码
def test_get():
    collection_id = 'abcd'
    response = {
        '_id': 'myIbIFkZphQSbQ',
        'items': [example_item]
    }
    responses.add(responses.GET,
                  '%scollections/%s/items' % (BASE_URL, collection_id),
                  body=json.dumps(response),
                  status=200,
                  content_type='application/json')

    client = TwitchClient('client id', 'oauth token')

    items = client.collections.get(collection_id)

    assert len(responses.calls) == 1
    assert len(items) == 1
    item = items[0]
    assert isinstance(item, Item)
    assert item.id == example_item['_id']
    assert item.title == example_item['title']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号