def test_get_post_comments():
channel_id = '1234'
post_id = example_post['id']
response = {
'_cursor': '1480651694954867000',
'_total': 1,
'comments': [example_comment]
}
responses.add(responses.GET,
'%sfeed/%s/posts/%s/comments' % (BASE_URL, channel_id, post_id),
body=json.dumps(response),
status=200,
content_type='application/json')
client = TwitchClient('client id')
comments = client.channel_feed.get_post_comments(channel_id, post_id)
assert len(responses.calls) == 1
assert len(comments) == 1
comment = comments[0]
assert isinstance(comment, Comment)
assert comment.id == example_comment['id']
assert comment.body == example_comment['body']
评论列表
文章目录