python类parametrize()的实例源码

test_api.py 文件源码 项目:gobble 作者: openspending 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_handle_raises_error_if_status_is_400(api_call):
    responses.add(api_call.method, api_call.url, body=HTTPError())
    with raises(HTTPError):
        handle(api_call())


# @responses.activate
# @mark.parametrize('api_call', api_calls)
# def test_call_endpoint_with_query_parameters(api_call):
#     responses.add(
#         api_call.method,
#         api_call.url + '?spam=eggs&foo=bar',
#         match_querystring=False
#     )
#     params = dict(foo='bar', spam='eggs')
#     assert api_call(params=params).status_code == 200
test_snapshots.py 文件源码 项目:gobble 作者: openspending 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_remove_secrets_does_its_job(unsecure_json, secure_json):
    freeze(unsecure_json)
    assert unsecure_json == secure_json


# @responses.activate
# @mark.parametrize('function', api_functions)
# def test_endpoint_saves_request_snapshot_to_file(function):
#     function()
#     assert isfile(function.snapshot._filepath)
#     assert function.snapshot._filepath.endswith('json')
# # noinspection PyShadowingNames,PyUnusedLocal


问题


面经


文章

微信
公众号

扫码关注公众号