def test_existing_resource():
url_expr = re.compile(r'https?://api\.test\.tst/v1/videos/show\?.*'
'video_key=VideoKey.*')
responses.add(
responses.GET, url_expr,
status=200,
content_type='application/json',
body='{"status": "ok", '
'"rate_limit": {"reset": 1478929300, "limit": 50, "remaining": 47},'
'"video": {"status": "ready", "expires_date": null, "description": null, '
'"title": "Title", "views": 179, "tags": "", "sourceformat": null, '
'"mediatype": "video", "upload_session_id": null, "custom": {}, '
'"duration": "817.56", "sourceurl": null, "link": null, "author": null, '
'"key": "VideoKey", "error": null, "date": 1464754765, '
'"md5": "653bc15b6cba7319c2df9b5cf869b5b8", "sourcetype": "file", '
'"size": "904237686"}}')
jwp_client = jwplatform.Client('api_key', 'api_secret', host='api.test.tst')
resp = jwp_client.videos.show(video_key='VideoKey')
assert resp['status'] == 'ok'
assert 'status' in resp['video']
assert resp['video']['key'] == 'VideoKey'
评论列表
文章目录