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.

44 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2009-2017 Noviat.
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp.tests.common import TransactionCase
  5. class TestCommon(TransactionCase):
  6. """ Common tests for all reports """
  7. def setUp(self):
  8. super(TestCommon, self).setUp()
  9. self.model = self.env[self._getReportModel()]
  10. self.report_name = self._getReportName()
  11. wiz_vals = {'chart_account_id': self.env.ref('account.chart0').id}
  12. wiz_vals.update(self._getBaseFilters())
  13. self.report = self.model.create(wiz_vals)
  14. def common_test_01_generation_report(self):
  15. """ Check if report is correctly generated """
  16. # Check if returned report action is correct
  17. report_action = self.report.check_report()
  18. self.assertDictContainsSubset(
  19. {'type': 'ir.actions.report.xml',
  20. 'report_name': self.report_name},
  21. report_action)
  22. def _getReportModel(self):
  23. """
  24. :return: the report model name
  25. """
  26. raise NotImplementedError()
  27. def _getReportName(self):
  28. """
  29. :return: the xls report name
  30. """
  31. raise NotImplementedError()
  32. def _getBaseFilters(self):
  33. """
  34. :return: the minimum required filters to generate report
  35. """
  36. raise NotImplementedError()