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