diff options
| author | Sébastien Theys <seb@odoo.com> | 2019-08-01 11:20:33 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2019-08-02 16:47:58 +0000 |
| commit | 58a2ffa26f1a3b0f9630ce16d11b758d18e20a21 (patch) | |
| tree | e737f6abdd166c7da94827de9d968ad2d7478dde /addons/product/tests | |
| parent | 8206b5b4cc92b6befd98ebec7f7ef8af588a9b68 (diff) | |
[IMP] *: rename image fields
image_original => image_1920 (now resized to 1920)
image_big => image_1024
image_large => image_256
image_medium => image_128
image_small => image_64
image replaced by image_1920 (when writing) or by image_1024 (when displaying
what was previously the big size)
+ add new intermediate format:
image_512
PR: #34925
Diffstat (limited to 'addons/product/tests')
| -rw-r--r-- | addons/product/tests/test_variants.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/addons/product/tests/test_variants.py b/addons/product/tests/test_variants.py index ccddf89c662..f07553a9141 100644 --- a/addons/product/tests/test_variants.py +++ b/addons/product/tests/test_variants.py @@ -501,7 +501,7 @@ class TestVariantsImages(common.TestProductCommon): self.images.update({color: base64.b64encode(f.read())}) self.env['product.product'].create({ - 'image_raw_original': self.images[color], + 'image_variant_max': self.images[color], 'attribute_value_ids': [(6, 0, [color_value.id])], 'product_tmpl_id': self.template.id, }) @@ -511,7 +511,7 @@ class TestVariantsImages(common.TestProductCommon): return res def test_variant_images(self): - """Check that on variant, the image used is the image_raw_original if set, + """Check that on variant, the image used is the image_variant_max if set, and defaults to the template image otherwise. """ f = io.BytesIO() @@ -519,29 +519,29 @@ class TestVariantsImages(common.TestProductCommon): f.seek(0) image_black = base64.b64encode(f.read()) - images = self.variants.mapped('image_original') + images = self.variants.mapped('image_1920') self.assertEqual(len(set(images)), 4) variant_no_image = self.variants[0] - self.assertFalse(variant_no_image.image) - self.template.image = image_black + self.assertFalse(variant_no_image.image_1920) + self.template.image_1920 = image_black # the first has no image variant, all the others do - self.assertFalse(variant_no_image.image_raw_original) + self.assertFalse(variant_no_image.image_variant_max) self.assertTrue(all(images[1:])) # template image is the same as this one, since it has no image variant - self.assertEqual(variant_no_image.image, self.template.image) + self.assertEqual(variant_no_image.image_1920, self.template.image_1920) # having changed the template image should not have changed these - self.assertEqual(images[1:], self.variants.mapped('image')[1:]) + self.assertEqual(images[1:], self.variants.mapped('image_1920')[1:]) def test_update_images_with_archived_variants(self): """Update images after variants have been archived""" self.variants[1:].write({'active': False}) - self.variants[0].image = self.images['red'] - self.assertEqual(self.template.image, self.images['red']) - self.assertEqual(self.variants[0].image_raw_original, False) - self.assertEqual(self.variants[0].image, self.images['red']) + self.variants[0].image_1920 = self.images['red'] + self.assertEqual(self.template.image_1920, self.images['red']) + self.assertEqual(self.variants[0].image_variant_max, False) + self.assertEqual(self.variants[0].image_1920, self.images['red']) class TestVariantsArchive(common.TestProductCommon): |
