def test_update():
channel_id = example_channel['_id']
responses.add(responses.PUT,
'%schannels/%s' % (BASE_URL, channel_id),
body=json.dumps(example_channel),
status=200,
content_type='application/json')
client = TwitchClient('client id', 'oauth token')
status = 'Spongebob Squarepants'
channel = client.channels.update(channel_id, status=status)
assert len(responses.calls) == 1
expected_body = json.dumps({'channel': {'status': status}}).encode('utf-8')
assert responses.calls[0].request.body == expected_body
assert isinstance(channel, Channel)
assert channel.id == channel_id
assert channel.name == example_channel['name']
评论列表
文章目录