Commit a2e95580 authored by Jérome Perrin's avatar Jérome Perrin

core_test: minimal test for Base_generateBarcodeImage

parent 81c0dc80
...@@ -2178,3 +2178,26 @@ class TestImage(ERP5TypeTestCase): ...@@ -2178,3 +2178,26 @@ class TestImage(ERP5TypeTestCase):
content_type, content_type,
(filename, image.getContentType(), content_type)) (filename, image.getContentType(), content_type))
self.portal.manage_delObjects([self.id()]) self.portal.manage_delObjects([self.id()])
class Base_generateBarcodeImageTest(ERP5TypeTestCase):
def test_datamatrix_png(self):
png = self.portal.Base_generateBarcodeImage(
barcode_type='datamatrix', data=b'test')
self.assertTrue(png.startswith(b'\x89PNG'), png)
def test_ean13_png(self):
png = self.portal.Base_generateBarcodeImage(
barcode_type='ean13', data=b'0799439112766')
self.assertTrue(png.startswith(b'\x89PNG'), png)
def test_code128_png(self):
png = self.portal.Base_generateBarcodeImage(
barcode_type='code128', data=b'123')
self.assertTrue(png.startswith(b'\x89PNG'), png)
def test_qrcode_png(self):
png = self.portal.Base_generateBarcodeImage(
barcode_type='qrcode', data=b'test')
self.assertTrue(png.startswith(b'\x89PNG'), png)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment