예제 #1
0
파일: helpers.py 프로젝트: slmingol/tavern
def validate_pykwalify(response, schema):
    """Make sure the response matches a given schema

    Args:
        response (Response): reqeusts.Response object
        schema (dict): Schema for response
    """
    with wrapfile(response.json()) as rdump, wrapfile(schema) as sdump:
        verify_generic(rdump, sdump)
예제 #2
0
def validate_pykwalify(response, schema):
    """Make sure the response matches a given schema

    Args:
        response (Response): reqeusts.Response object
        schema (dict): Schema for response
    """
    try:
        to_verify = response.json()
    except TypeError as e:
        raise_from(exceptions.BadSchemaError("Tried to match a pykwalify schema against a non-json response"), e)
    else:
        verify_generic(to_verify, schema)