def test_get_followers():
channel_id = example_channel['_id']
response = {
'_cursor': '1481675542963907000',
'_total': 41,
'follows': [example_follower]
}
responses.add(responses.GET,
'%schannels/%s/follows' % (BASE_URL, channel_id),
body=json.dumps(response),
status=200,
content_type='application/json')
client = TwitchClient('client id')
followers = client.channels.get_followers(channel_id)
assert len(responses.calls) == 1
assert len(followers) == 1
follow = followers[0]
assert isinstance(follow, Follow)
assert follow.notifications == example_follower['notifications']
assert isinstance(follow.user, User)
assert follow.user.id == example_user['_id']
assert follow.user.name == example_user['name']
评论列表
文章目录