Ejemplo n.º 1
0
def test_valid_full(vocabulary_clear):
    valid_full = {
        "description": "A Romans story",
        "type": "other",
        "lang": "eng"
    }
    assert valid_full == DescriptionSchema().load(valid_full)
def test_invalid_lang(vocabulary_clear):
    invalid_lang = {
        "description": "A Romans story",
        "type": "other",
        "lang": "inv"
    }

    assert_raises_messages(lambda: DescriptionSchema().load(invalid_lang), {
        'lang': ['Language must be a lower-cased 3-letter ISO 639-3 string.']
    })
Ejemplo n.º 3
0
def test_invalid_description_empty(vocabulary_clear):
    invalid_description_empty = {
        "description": "",
        "type": "other",
        "lang": "eng"
    }

    assert_raises_messages(
        lambda: DescriptionSchema().load(invalid_description_empty),
        {'description': ['Shorter than minimum length 3.']})
def test_valid_full():
    valid_full = {
        "description": "A Romans story",
        "type": {
            "id": "other"
        },
        "lang": {
            "id": "eng"
        }
    }
    assert valid_full == DescriptionSchema().load(valid_full)
Ejemplo n.º 5
0
def test_invalid_too_short(vocabulary_clear):
    too_short = {
        "description": "AA",
        "type": {
            "id": "other"
        },
        "lang": {
            "id": "eng"
        }
    }

    assert_raises_messages(lambda: DescriptionSchema().load(too_short),
                           {'description': ['Shorter than minimum length 3.']})
Ejemplo n.º 6
0
def test_invalid_description_type(vocabulary_clear):
    invalid_description_type = {
        "description": "A Romans story",
        "type": "Invalid",
        "lang": {
            "id": "eng"
        }
    }

    assert_raises_messages(
        lambda: DescriptionSchema().load(invalid_description_type),
        {'type': {
            '_schema': ['Invalid input type.']
        }})
Ejemplo n.º 7
0
def test_invalid_description_type(vocabulary_clear):
    invalid_description_type = {
        "description": "A Romans story",
        "type": "Invalid",
        "lang": "eng"
    }

    assert_raises_messages(
        lambda: DescriptionSchema().load(invalid_description_type), {
            'type': [
                _("Invalid description type. Invalid not one of abstract, " +
                  "methods, seriesinformation, tableofcontents, technicalinfo, "
                  + "other.")
            ]
        })
def test_invalid_no_description(vocabulary_clear):
    invalid_no_description = {"type": "other", "lang": {"id": "eng"}}

    assert_raises_messages(
        lambda: DescriptionSchema().load(invalid_no_description),
        {'description': ['Missing data for required field.']})
def test_valid_minimal(vocabulary_clear):
    valid_minimal = {"description": "A Romans story", "type": "other"}
    assert valid_minimal == DescriptionSchema().load(valid_minimal)
def test_valid_minimal():
    valid_minimal = {"description": "A Romans story", "type": {"id": "other"}}
    assert valid_minimal == DescriptionSchema().load(valid_minimal)