Example #1
0
def create_record(record):
    """Create record from marc21 model."""
    json = overdo_marc_dict(record)

    if '$schema' in json:
        json['$schema'] = url_for('invenio_jsonschemas.get_schema',
                                  schema_path="records/{0}".format(
                                      json['$schema']))

    return json
Example #2
0
def test_overdo_marc_dict_handles_journalsnew():
    record = {
        '980__': {
            'a': 'JOURNALSNEW'
        },
    }

    expected = {
        '$schema': 'journals.json',
        '_collections': [
            'Journals',
        ],
    }
    result = overdo_marc_dict(record)

    assert expected == result
Example #3
0
def test_overdo_marc_dict_handles_data():
    record = {
        '980__': [
            {
                'a': 'DATA'
            },
        ],
    }

    expected = {
        '$schema': 'data.json',
        '_collections': [
            'Data',
        ],
    }
    result = overdo_marc_dict(record)

    assert expected == result