def test_rights_licensing_properties_in_iiif_json(self): info = ImageInfo( src_img_fp=self.test_jpeg_fp, src_format=self.test_jpeg_fmt, license='CC-BY', logo='logo.png', attribution='Author unknown', ) info.from_image_file() iiif_json = json.loads( info.to_iiif_json(base_uri='http://localhost/1234')) assert iiif_json['license'] == 'CC-BY' assert iiif_json['logo'] == 'logo.png' assert iiif_json['attribution'] == 'Author unknown'
def test_extrainfo_appears_in_iiif_json(self): info = ImageInfo( src_img_fp=self.test_jpeg_fp, src_format=self.test_jpeg_fmt, extra={'extraInfo': { 'license': 'CC-BY', 'logo': 'logo.png', 'service': {'@id': 'my_service'}, 'attribution': 'Author unknown', }} ) info.from_image_file() iiif_json = json.loads(info.to_iiif_json()) assert iiif_json['license'] == 'CC-BY' assert iiif_json['logo'] == 'logo.png' assert iiif_json['service'] == {'@id': 'my_service'} assert iiif_json['attribution'] == 'Author unknown'
def test_invalid_src_format_is_error(self, src_format): info = ImageInfo(src_format=src_format) with pytest.raises(ImageInfoException) as exc: info.from_image_file()