test_resource.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:jwplatform-py 作者: jwplayer 项目源码 文件源码
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'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号