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'
评论列表
文章目录