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.

19 lines
623 B

  1. # Copyright 2018 Eficent Business and IT Consulting Services S.L.
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  3. def setup_test_model(env, model_clses):
  4. for model_cls in model_clses:
  5. model_cls._build_model(env.registry, env.cr)
  6. env.registry.setup_models(env.cr)
  7. env.registry.init_models(
  8. env.cr, [model_cls._name for model_cls in model_clses],
  9. dict(env.context, update_custom_fields=True)
  10. )
  11. def teardown_test_model(env, model_clses):
  12. for model_cls in model_clses:
  13. del env.registry.models[model_cls._name]
  14. env.registry.setup_models(env.cr)