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 (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().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_code_qty > 0 or
  16. module.xml_code_qty > 0 or
  17. module.js_code_qty > 0,
  18. "module '%s' doesn't have code analysed defined, whereas it is"
  19. " installed." % (module.name))
  20. def test_uninstalled_modules(self):
  21. uninstalled_modules = self.IrModuleModule.search(
  22. [('state', '!=', 'installed')])
  23. for module in uninstalled_modules:
  24. self.assertTrue(
  25. module.python_code_qty == 0,
  26. "module '%s' has python lines defined, whereas it is"
  27. " not installed." % (module.name))