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
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
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