Example #1
0
 def test20_write_full_example_in_spec(self):
     """Create example info.json in spec."""
     i = IIIFInfo(
         api_version='3.0',
         id=
         "https://example.org/image-service/abcd1234/1E34750D-38DB-4825-A38A-B60A345E591C",
         # "protocol" : "http://iiif.io/api/image",
         width=6000,
         height=4000,
         sizes=[{
             "width": 150,
             "height": 100
         }, {
             "width": 600,
             "height": 400
         }, {
             "width": 3000,
             "height": 2000
         }],
         tiles=[{
             "width": 512,
             "scaleFactors": [1, 2, 4]
         }, {
             "width": 1024,
             "height": 2048,
             "scaleFactors": [8, 16]
         }],
         attribution=[{
             "@value": "<span>Provided by Example Organization</span>",
             "@language": "en"
         }, {
             "@value": "<span>Darparwyd gan Enghraifft Sefydliad</span>",
             "@language": "cy"
         }],
         logo={
             "id":
             "https://example.org/image-service/logo/square/200,200/0/default.png",
             "service": [{
                 "id": "https://example.org/image-service/logo",
                 "profile": "level2",
                 'type': 'ImageService3'
             }]
         },
         license=[
             "https://example.org/rights/license1.html",
             "http://rightsstatements.org/vocab/InC-EDU/1.0/"
         ],
         profile="level1",
         extra_formats=["gif", "pdf"],
         extra_qualities=["color", "gray"],
         extra_features=[
             "canonicalLinkHeader", "rotationArbitrary", "profileLinkHeader"
         ],
         service=[{
             'id': 'http://example.org/fix/me'
         }])
     i.add_context("http://example.org/extension/context1.json")
     reparsed_json = json.loads(i.as_json())
     example_json = json.load(
         self.open_testdata('info_from_spec_section_5_8.json'))
     self.maxDiff = 4000
     self.assertEqual(reparsed_json, example_json)