OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
686 B

5 years ago
  1. # Copyright 2019 Creu Blanca
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo.tests.common import HttpCase
  4. class TestReportQr(HttpCase):
  5. def test_qr_generation(self):
  6. data = 'TEST'
  7. image = self.url_open('/report/qr?value=%s' % data)
  8. self.assertEqual(image.headers['Content-type'], 'image/png')
  9. def test_qr_overflow(self):
  10. """There is a QR limitation for 4296 characters, we will test that an
  11. Exception is raised"""
  12. new_data = ''
  13. for i in range(0, 1500):
  14. new_data += 'TEST'
  15. with self.assertRaises(Exception):
  16. self.env['ir.actions.report'].qr_generate(new_data)