Beispiel #1
0
    def setUp(self):
        super(TestPhoto, self).setUp()

        # fixtures
        create_photo_formats(self)

        create_photo(self)
Beispiel #2
0
    def setUp(self):
        super(TestPhoto, self).setUp()

        # fixtures
        create_photo_formats(self)

        create_photo(self)
Beispiel #3
0
    def test_formated_photo_from_master_format_is_used(self):
        master_format = Format.objects.create(
            name='sample',
            max_width=300,
            max_height=200,
            flexible_height=False,
            stretch=False,
            nocrop=False
        )
        slave_format = Format.objects.create(
            name='slave',
            max_width=300,
            max_height=100,
            flexible_height=False,
            stretch=False,
            nocrop=False,
            master=master_format
        )
        master_fp = FormatedPhoto(photo=self.photo, format=master_format)
        p2 = create_photo(self, color=(123, 123, 123), size=(300, 200))
        p2.image.open()
        master_fp.image.save(p2.image.name, p2.image)
        master_fp.save()

        fp = FormatedPhoto(photo=self.photo, format=slave_format)
        fp.save()

        fp.image.open()
        i = Image.open(fp.image)
        tools.assert_equals((123, 123, 123), i.getpixel((10, 10)))
        tools.assert_equals((300, 100), i.size)
        p2.image.close()
Beispiel #4
0
    def test_formated_photo_from_master_format_is_used(self):
        master_format = Format.objects.create(
            name='sample',
            max_width=300,
            max_height=200,
            flexible_height=False,
            stretch=False,
            nocrop=False
        )
        slave_format = Format.objects.create(
            name='slave',
            max_width=300,
            max_height=100,
            flexible_height=False,
            stretch=False,
            nocrop=False,
            master=master_format
        )
        master_fp = FormatedPhoto(photo=self.photo, format=master_format)
        p2 = create_photo(self, color=(123, 123, 123), size=(300, 200))
        p2.image.open()
        master_fp.image.save(p2.image.name, p2.image)
        master_fp.save()

        fp = FormatedPhoto(photo=self.photo, format=slave_format)
        fp.save()

        fp.image.open()
        i = Image.open(fp.image)
        tools.assert_equals((123, 123, 123), i.getpixel((10, 10)))
        tools.assert_equals((300, 100), i.size)
        p2.image.close()
Beispiel #5
0
    def _set_photo(self):
        from test_ella.test_photos.fixtures import create_photo

        photo = create_photo(self)

        self.publishables[0].photo = photo
        self.publishables[0].save()
        # update the cache on the Listing object
        self.listings[0].publishable = self.publishables[0]
Beispiel #6
0
    def _set_photo(self):
        from test_ella.test_photos.fixtures import create_photo

        photo = create_photo(self)

        self.publishables[0].photo = photo
        self.publishables[0].save()
        # update the cache on the Listing object
        self.listings[0].publishable = self.publishables[0]