Exemple #1
0
def test_title_is_required():
    data = {}
    with pytest.raises(ValidationError) as err:
        info_validator(data)

    assert_message_in_errors(
        MESSAGES['required']['required'],
        err.value.detail,
        'required.title',
    )
Exemple #2
0
def test_title_is_required():
    data = {}
    with pytest.raises(ValidationError) as err:
        info_validator(data)

    assert_message_in_errors(
        MESSAGES['required']['required'],
        err.value.detail,
        'required.title',
    )
Exemple #3
0
def test_description_must_be_a_string(value):
    data = {
        'description': value,
    }
    with pytest.raises(ValidationError) as err:
        info_validator(data)

    assert_message_in_errors(
        MESSAGES['type']['invalid'],
        err.value.detail,
        'description.type',
    )
Exemple #4
0
def test_title_type_must_be_string(value):
    data = {
        'title': value,
    }
    with pytest.raises(ValidationError) as err:
        info_validator(data)

    assert_message_in_errors(
        MESSAGES['type']['invalid'],
        err.value.detail,
        'title.type',
    )
Exemple #5
0
def test_description_must_be_a_string(value):
    data = {
        'description': value,
    }
    with pytest.raises(ValidationError) as err:
        info_validator(data)

    assert_message_in_errors(
        MESSAGES['type']['invalid'],
        err.value.detail,
        'description.type',
    )
Exemple #6
0
def test_title_type_must_be_string(value):
    data = {
        'title': value,
    }
    with pytest.raises(ValidationError) as err:
        info_validator(data)

    assert_message_in_errors(
        MESSAGES['type']['invalid'],
        err.value.detail,
        'title.type',
    )
Exemple #7
0
def test_contact_must_be_an_object(value):
    data = {
        'contact': value,
    }
    with pytest.raises(ValidationError) as err:
        info_validator(data)

    assert_message_in_errors(
        MESSAGES['type']['invalid'],
        err.value.detail,
        'contact.type',
    )
def test_license_must_be_an_object(value):
    data = {
        'license': value,
    }
    with pytest.raises(ValidationError) as err:
        info_validator(data)

    assert_message_in_errors(
        MESSAGES['type']['invalid'],
        err.value.detail,
        'license.type',
    )
Exemple #9
0
def test_description_is_not_required():
    data = {}
    try:
        info_validator(data)
    except ValidationError as err:
        errors = err.detail
    else:
        errors = {}

    assert_path_not_in_errors(
        'description.required',
        errors,
    )
Exemple #10
0
def test_terms_of_service_is_not_required():
    data = {}
    try:
        info_validator(data)
    except ValidationError as err:
        errors = err.detail
    else:
        errors = {}

    assert_path_not_in_errors(
        'termsOfService.required',
        errors,
    )
Exemple #11
0
def test_description_is_not_required():
    data = {}
    try:
        info_validator(data)
    except ValidationError as err:
        errors = err.detail
    else:
        errors = {}

    assert_path_not_in_errors(
        'description.required',
        errors,
    )
Exemple #12
0
def test_terms_of_service_is_not_required():
    data = {}
    try:
        info_validator(data)
    except ValidationError as err:
        errors = err.detail
    else:
        errors = {}

    assert_path_not_in_errors(
        'termsOfService.required',
        errors,
    )