Exemplo n.º 1
0
def test_valid_unkown():
    valid_unknown = {
        "name": "Entity One",
        "identifiers": {
            "unknown": "12345abcde"
        }
    }
    assert valid_unknown == AffiliationSchema().load(valid_unknown)
Exemplo n.º 2
0
def test_invalid_no_name():
    invalid_no_name = {
        "identifiers": [{
            "identifier": "03yrm5c26",
            "scheme": "ror"
        }]
    }
    with pytest.raises(ValidationError):
        data = AffiliationSchema().load(invalid_no_name)
Exemplo n.º 3
0
def test_valid():
    valid_full = {
        "name": "Entity One",
        "identifiers": [{
            "identifier": "03yrm5c26",
            "scheme": "ror"
        }]
    }
    assert valid_full == AffiliationSchema().load(valid_full)
Exemplo n.º 4
0
def test_invalid_unkown():
    invalid_unknown = {
        "name": "Entity One",
        "identifiers": [{
            "identifier": "12345abcde",
            "scheme": "unknown"
        }]
    }

    with pytest.raises(ValidationError):
        data = AffiliationSchema().load(invalid_unknown)
Exemplo n.º 5
0
def test_invalid_value():
    invalid_no_value = {
        "name": "Entity One",
        "identifiers": [{
            "identifier": "inv",
            "scheme": "ror"
        }]
    }

    with pytest.raises(ValidationError):
        data = AffiliationSchema().load(invalid_no_value)
Exemplo n.º 6
0
def test_valid_empty_scheme():
    valid_affiliation = {
        "name": "Entity One",
        "identifiers": [{
            "identifier": "03yrm5c26",
            "scheme": ""
        }]
    }

    loaded = AffiliationSchema().load(valid_affiliation)
    valid_affiliation["identifiers"][0]["scheme"] = "ror"
    assert valid_affiliation == loaded
def test_invalid_empty():
    invalid_empty = {}
    with pytest.raises(ValidationError):
        data = AffiliationSchema().load(invalid_empty)
def test_invalid_both_id_name():
    invalid_id_name = {"id": "test", "name": "Entity One"}
    with pytest.raises(ValidationError):
        data = AffiliationSchema().load(invalid_id_name)
def test_valid_name():
    valid_name = {"name": "Entity One"}
    assert valid_name == AffiliationSchema().load(valid_name)
def test_valid_id():
    valid_id = {
        "id": "test",
    }
    assert valid_id == AffiliationSchema().load(valid_id)
Exemplo n.º 11
0
def test_invalid_empty():
    invalid_empty = {"name": "Entity One", "identifiers": [{}]}

    with pytest.raises(ValidationError):
        data = AffiliationSchema().load(invalid_empty)
Exemplo n.º 12
0
def test_valid_empty_identifiers():
    valid_affiliation = {"name": "Entity One", "identifiers": []}
    assert valid_affiliation == AffiliationSchema().load(valid_affiliation)
Exemplo n.º 13
0
def test_valid_no_identifiers():
    valid_affiliation = {
        "name": "Entity One",
    }
    assert valid_affiliation == AffiliationSchema().load(valid_affiliation)
Exemplo n.º 14
0
def test_invalid_empty_key():
    invalid_key = {"name": "Entity One", "identifiers": {"": "03yrm5c26"}}
    with pytest.raises(ValidationError):
        data = AffiliationSchema().load(invalid_key)
Exemplo n.º 15
0
def test_invalid_empty_value():
    invalid_value = {"name": "Entity One", "identifiers": {"ror": ""}}
    with pytest.raises(ValidationError):
        data = AffiliationSchema().load(invalid_value)