details: https://code.tryton.org/tryton/commit/fc7691c60214
branch: default
user: Cédric Krier <[email protected]>
date: Thu Aug 28 10:51:26 2025 +0200
description:
Replace picsum service by our own images in product image tests
Closes #14201
diffstat:
modules/product_image/tests/test_module.py | 13 ++++++++-----
modules/product_image_attribute/tests/test_module.py | 12 ++++++++----
2 files changed, 16 insertions(+), 9 deletions(-)
diffs (80 lines):
diff -r 263a83d4a8ad -r fc7691c60214 modules/product_image/tests/test_module.py
--- a/modules/product_image/tests/test_module.py Mon Jun 30 17:01:31
2025 +0200
+++ b/modules/product_image/tests/test_module.py Thu Aug 28 10:51:26
2025 +0200
@@ -31,7 +31,8 @@
image = Image(template=template)
image.image = urllib.request.urlopen(
- 'https://picsum.photos/200').read()
+ 'https://downloads.tryton.org/tests/product-image/chair.jpg'
+ ).read()
image.save()
self.assertEqual(template.image_url, None)
@@ -62,7 +63,8 @@
image = Image(template=template)
image.image = urllib.request.urlopen(
- 'https://picsum.photos/200/400').read()
+ 'https://downloads.tryton.org/tests/product-image/chair-800.jpg'
+ ).read()
image.save()
self.assertEqual(template.image_url, None)
@@ -73,10 +75,10 @@
r'/product/image/CODE/.*/Template\?s=64')
img = PIL.Image.open(io.BytesIO(image.get(size=100)))
- self.assertEqual(img.size, (50, 100))
+ self.assertEqual(img.size, (78, 100))
img = PIL.Image.open(io.BytesIO(image.get(size=(100, 200))))
- self.assertEqual(img.size, (100, 200))
+ self.assertEqual(img.size, (100, 128))
@with_transaction()
def test_round_size(self):
@@ -110,7 +112,8 @@
for _ in range(3):
image = Image(template=template)
image.image = urllib.request.urlopen(
- 'https://picsum.photos/200').read()
+ 'https://downloads.tryton.org/tests/product-image/chair.jpg'
+ ).read()
image.save()
template.write_date = dt.datetime(2025, 1, 1) # fix timestamp
diff -r 263a83d4a8ad -r fc7691c60214
modules/product_image_attribute/tests/test_module.py
--- a/modules/product_image_attribute/tests/test_module.py Mon Jun 30
17:01:31 2025 +0200
+++ b/modules/product_image_attribute/tests/test_module.py Thu Aug 28
10:51:26 2025 +0200
@@ -45,22 +45,26 @@
product.save()
image1 = Image(template=template)
image1.image = urllib.request.urlopen(
- 'https://picsum.photos/200').read()
+ 'https://downloads.tryton.org/tests/product-image/chair.jpg'
+ ).read()
image1.save()
image2 = Image(template=template, product=product)
image2.image = urllib.request.urlopen(
- 'https://picsum.photos/200').read()
+ 'https://downloads.tryton.org/tests/product-image/chair.jpg'
+ ).read()
image2.save()
image3 = Image(template=template)
image3.image = urllib.request.urlopen(
- 'https://picsum.photos/200').read()
+ 'https://downloads.tryton.org/tests/product-image/chair.jpg'
+ ).read()
image3.attributes = {
'attr1': 'foo',
}
image3.save()
image4 = Image(template=template)
image4.image = urllib.request.urlopen(
- 'https://picsum.photos/200').read()
+ 'https://downloads.tryton.org/tests/product-image/chair.jpg'
+ ).read()
image4.attributes = {
'attr1': 'bar',
}