test_add_target.py 文件源码

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

项目:vws-python 作者: adamtheturtle 项目源码 文件源码
def assert_success(response: Response) -> None:
    """
    Assert that the given response is a success response for adding a
    target.

    Raises:
        AssertionError: The given response is not a valid success response
            for adding a target.
    """
    assert_vws_response(
        response=response,
        status_code=codes.CREATED,
        result_code=ResultCodes.TARGET_CREATED,
    )
    expected_keys = {'result_code', 'transaction_id', 'target_id'}
    assert response.json().keys() == expected_keys
    target_id = response.json()['target_id']
    assert len(target_id) == 32
    assert all(char in hexdigits for char in target_id)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号