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.2 KiB

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