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.

33 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 Avoin.Systems
  3. # Copyright 2017 Eficent Business and IT Consulting Services, S.L.
  4. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  5. import odoo.tests
  6. from odoo.exceptions import ValidationError
  7. @odoo.tests.common.at_install(False)
  8. @odoo.tests.common.post_install(True)
  9. class TestWkhtmltopdf(odoo.tests.TransactionCase):
  10. def test_wkhtmltopdf_incorrect_parameter(self):
  11. for report_paperformat in self.env['report.paperformat'].search([]):
  12. with self.assertRaises(ValidationError):
  13. report_paperformat.update({
  14. 'custom_params': [(0, 0, {
  15. 'name': 'bad-parameter'
  16. })]})
  17. def test_wkhtmltopdf_valid_parameter(self):
  18. for report_paperformat in self.env['report.paperformat'].search([]):
  19. error = False
  20. try:
  21. report_paperformat.update({
  22. 'custom_params': [(0, 0, {
  23. 'name': '--disable-smart-shrinking'
  24. })]})
  25. except ValidationError:
  26. error = True
  27. self.assertEquals(error, False,
  28. "There was an error adding wkhtmltopdf "
  29. "parameter --disable-smart-shrinking")