def test_check_subscribed_to_channel():
user_id = 1234
channel_id = 12345
response = {
'_id': 'c660cb408bc3b542f5bdbba52f3e638e652756b4',
'created_at': '2016-12-12T15:52:52Z',
'channel': example_channel,
}
responses.add(responses.GET,
'%susers/%s/subscriptions/%s' % (BASE_URL, user_id, channel_id),
body=json.dumps(response),
status=200,
content_type='application/json')
client = TwitchClient('client id', 'oauth token')
subscription = client.users.check_subscribed_to_channel(user_id, channel_id)
assert len(responses.calls) == 1
assert isinstance(subscription, Subscription)
assert subscription.id == response['_id']
assert isinstance(subscription.channel, Channel)
assert subscription.channel.id == example_channel['_id']
assert subscription.channel.name == example_channel['name']
评论列表
文章目录