예제 #1
0
def test_operation_with_valid_value(method, msg_assertions):
    try:
        path_item_validator({'get': {}})
    except ValidationError as err:
        errors = err.detail
    else:
        errors = {}

    msg_assertions.assert_path_not_in_errors(method, errors)
예제 #2
0
def test_operation_type_validation(value, method, MESSAGES, msg_assertions):
    with pytest.raises(ValidationError) as err:
        path_item_validator({method: value})

    msg_assertions.assert_message_in_errors(
        MESSAGES['type']['invalid'],
        err.value.detail,
        '{0}.type'.format(method),
    )
예제 #3
0
def test_operations_are_not_required(method, msg_assertions):
    try:
        path_item_validator({})
    except ValidationError as err:
        errors = err.detail
    else:
        errors = {}

    msg_assertions.assert_path_not_in_errors(method, errors)
예제 #4
0
def test_operation_with_valid_value(method, msg_assertions):
    try:
        path_item_validator({'get': {}})
    except ValidationError as err:
        errors = err.detail
    else:
        errors = {}

    msg_assertions.assert_path_not_in_errors(method, errors)
예제 #5
0
def test_operation_type_validation(value, method, MESSAGES, msg_assertions):
    with pytest.raises(ValidationError) as err:
        path_item_validator({method: value})

    msg_assertions.assert_message_in_errors(
        MESSAGES['type']['invalid'],
        err.value.detail,
        '{0}.type'.format(method),
    )
예제 #6
0
def test_operations_are_not_required(method, msg_assertions):
    try:
        path_item_validator({})
    except ValidationError as err:
        errors = err.detail
    else:
        errors = {}

    msg_assertions.assert_path_not_in_errors(method, errors)