test_resource.py 文件源码

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

项目:jwplatform-py 作者: jwplayer 项目源码 文件源码
def test_nonexisting_resource():
    url_expr = re.compile(r'https?://api\.test\.tst/v1/videos/abcd/show\?.*'
                          'abcd_key=AbcdKey.*')
    responses.add(
        responses.GET, url_expr,
        status=404,
        content_type='application/json',
        body='{"status": "error", '
             '"message": "API method `/videos/abcd/show` not found", '
             '"code": "NotFound", "title": "Not Found"}')

    jwp_client = jwplatform.Client('api_key', 'api_secret', host='api.test.tst')

    with pytest.raises(jwplatform.errors.JWPlatformNotFoundError) as err:
        jwp_client.videos.abcd.show(abcd_key='AbcdKey')

    assert err.value.message == 'API method `/videos/abcd/show` not found'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号