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.

31 lines
1.1 KiB

  1. # Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
  2. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo.tests.common import TransactionCase, post_install
  5. @post_install(True)
  6. class TestModule(TransactionCase):
  7. def setUp(self):
  8. super(TestModule, self).setUp()
  9. self.IrModuleModule = self.env['ir.module.module']
  10. def test_installed_modules(self):
  11. installed_modules = self.IrModuleModule.search(
  12. [('state', '=', 'installed')])
  13. for module in installed_modules:
  14. self.assertTrue(
  15. module.python_lines_qty > 0,
  16. "module '%s' doesn't have python lines defined, whereas it is"
  17. " installed.")
  18. def test_uninstalled_modules(self):
  19. uninstalled_modules = self.IrModuleModule.search(
  20. [('state', '!=', 'installed')])
  21. for module in uninstalled_modules:
  22. self.assertTrue(
  23. module.python_lines_qty == 0,
  24. "module '%s' has python lines defined, whereas it is"
  25. " not installed.")