def test_identity_check(app):
    """Test image model from XML into JSON."""
    with app.app_context():
        blob = create_record(CDS_IMAGE)
        data = marc21.do(blob)
        back_blob = to_marc21.do(data)
        assert blob == back_blob
    def test_image(self):
        """Test image model from XML into JSONi."""
        from dojson.contrib.marc21.utils import create_record
        from cds_dojson.marc21.models.image import (
            model as marc21
        )

        match = query_matcher(create_record(CDS_IMAGE))

        assert isinstance(match, marc21.__class__)

        blob = create_record(CDS_IMAGE)
        data = marc21.do(blob)

        # Check the control number (doJSON)
        assert data.get('control_number') == '1782445'

        # Check the parent album (CDSImage)
        assert data['album_parent'][0]['album_id'] == '2054964'

        # Check the imprint (CDSMarc21)
        assert data['imprint'][0]['place_of_publication'] == 'Geneva'

        # Check that no fields are missing their model
        assert marc21.missing(blob) == []
Exemple #3
0
def test_identity_check():
    """Test image model from XML into JSON."""
    blob = create_record(CDS_IMAGE)
    data = marc21.do(blob)
    back_blob = to_marc21.do(data)
    assert blob == back_blob