adding image stuff for composer_sort
@@ -142,6 +142,12 @@ class ImageStructureTestMixin(ArtTestMixin):
mediafile.images += [image]
mediafile.save()
+ image = Image(data=self.png_data, desc=u'the sortname of the composer',
+ type=ImageType.composer_sort)
+ mediafile.images += [image]
+ mediafile.save()
+
+
mediafile = MediaFile(mediafile.path)
self.assertEqual(len(mediafile.images), 3)
@@ -151,6 +157,12 @@ class ImageStructureTestMixin(ArtTestMixin):
image, desc=u'the composer', type=ImageType.composer
)
+ images = (i for i in mediafile.images if i.desc == u'the sortname of the composer')
+ image = next(images, None)
+ self.assertExtendedImageAttributes(
+ image, desc=u'the sortname of the composer', type=ImageType.composer_sort
+ )
+
def test_delete_image_structures(self):
mediafile = self._mediafile_fixture('image')
self.assertEqual(len(mediafile.images), 2)
@@ -194,6 +206,11 @@ class ExtendedImageStructureTestMixin(ImageStructureTestMixin):
mediafile.images += [image]
mediafile.save()
+ image = Image(data=self.tiff_data, desc=u'the sortname of the composer',
+ type=ImageType.composer_sort)
+ mediafile.images += [image]
+ mediafile.save()
+
mediafile = MediaFile(mediafile.path)
self.assertEqual(len(mediafile.images), 3)
@@ -203,6 +220,11 @@ class ExtendedImageStructureTestMixin(ImageStructureTestMixin):
self.assertExtendedImageAttributes(
image, desc=u'the composer', type=ImageType.composer)
+ image = list(filter(lambda i: i.mime_type == 'image/tiff',
+ mediafile.images))[0]
+ self.assertExtendedImageAttributes(
+ image, desc=u'the sortname of the composer', type=ImageType.composer_sort)
+
class LazySaveTestMixin(object):
"""Mediafile should only write changes when tags have changed
