def response_body(context): body = context.text context_jsons = json.loads(context.response.data) if isinstance(context_jsons, list): for _json in context_jsons: if _json['_id']: del _json['_id'] check_json(json.loads(body), context_jsons)
def step_impl(context): returned_json = context.response.json expected_json = json.loads(context.text) if 'id' in returned_json: returned_json.pop('id', None) expected_json.pop('id', None) else: raise IndexError('should have id key') check_json(expected_json, returned_json)
def return_json(context): result = context.response.json check_json(json.loads(context.text), result)
def response_body(context): json_response = context.response.json json_expected = json.loads(context.text) print("json", context.response.json) print("exp", json_expected) check_json(json_expected, json_response)
def response_body_alt(context): json_response = context.response.json json_expected = json.loads(context.text) check_json(json_expected, json_response)