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.

32 lines
1.3 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. @odoo.tests.common.at_install(False)
  7. @odoo.tests.common.post_install(True)
  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, {
  14. 'name': 'bad-parameter'
  15. })]})
  16. def test_wkhtmltopdf_valid_parameter(self):
  17. for report_paperformat in self.env['report.paperformat'].search([]):
  18. error = False
  19. try:
  20. report_paperformat.update({
  21. 'custom_params': [(0, 0, {
  22. 'name': '--disable-smart-shrinking'
  23. })]})
  24. except ValidationError:
  25. error = True
  26. self.assertEquals(error, False,
  27. "There was an error adding wkhtmltopdf "
  28. "parameter --disable-smart-shrinking")