Exemple #1
0
 def test_build_registry_1(self):
     draft_registry = {
         'img1': {
             'SIZE': '100',
             'DIMENSIONS': '100x100'
         },
         'img2': {
             'SIZE': '100',
             'DIMENSIONS': '100x100'
         },
         'img3': {
             'SIZE': '100',
             'DIMENSIONS': '100x100'
         },
         'img4': {
             'DIMENSIONS': '666x666'
         },
         'img5': {
             'DIMENSIONS': '666x666'
         },
         'img6': {
             'DIMENSIONS': '666x666'
         },
     }
     expected_registry = {
         'img1': ['100', '100x100'],
         'img2': ['100', '100x100'],
         'img3': ['100', '100x100'],
         'img4': ['666x666'],
         'img5': ['666x666'],
         'img6': ['666x666'],
     }
     registry = VimageConfig.build_registry(draft_registry)
     self.assertDictEqual(registry, expected_registry)
Exemple #2
0
 def test_build_registry_2(self):
     draft_registry = {
         'img1': {
             'SIZE': '100',
             'DIMENSIONS': '100x100',
             'FORMAT': 'png'
         },
         'img2': {
             'SIZE': '100',
             'DIMENSIONS': '100x100'
         },
         'img3': {
             'SIZE': '500',
             'DIMENSIONS': '500x640',
             'FORMAT': 'jpeg'
         },
     }
     expected_registry = {
         'img1': ['100', '100x100', 'png'],
         'img2': ['100', '100x100'],
         'img3': ['500', '500x640', 'jpeg'],
     }
     registry = VimageConfig.build_registry(draft_registry)
     self.assertDictEqual(registry, expected_registry)