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.

50 lines
1.9KB

  1. # Copyright (C) 2017-Today: Odoo Community Association (OCA)
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  4. from odoo.tests.common import TransactionCase
  5. from odoo.exceptions import ValidationError
  6. import os
  7. class TestAppDownload(TransactionCase):
  8. """Test for the Add download"""
  9. def setUp(self):
  10. super(TestAppDownload, self).setUp()
  11. test_path = os.path.dirname(os.path.realpath(__file__))
  12. module_path = os.path.join(test_path, "test_modules", "broken_lint")
  13. self.sub_child_product = self.env["product.product"].create(
  14. {"name": "business_requirement", "module_path": module_path}
  15. )
  16. module_path = os.path.join(test_path, "test_modules", "second_module")
  17. self.child_product = self.env["product.product"].create(
  18. {
  19. "name": "business_requirement_deliverable",
  20. "dependent_product_ids": [(6, 0, self.sub_child_product.ids)],
  21. "module_path": module_path,
  22. }
  23. )
  24. module_path = os.path.join(test_path, "test_modules", "test_module")
  25. self.main_app_product = self.env["product.product"].create(
  26. {
  27. "name": "business_requirement_deliverable_project",
  28. "module_path": module_path,
  29. }
  30. )
  31. def test_dependency(self):
  32. self.main_app_product.write(
  33. {"dependent_product_ids": [(6, 0, self.child_product.ids)]}
  34. )
  35. self.assertEqual(
  36. len(self.main_app_product.dependent_product_ids.ids),
  37. 1,
  38. "Dependency: App Dependency does not set properlly",
  39. )
  40. self.main_app_product.generate_zip_file()
  41. with self.assertRaises(ValidationError):
  42. self.main_app_product.write(
  43. {"dependent_product_ids": [(6, 0, self.main_app_product.ids)]}
  44. )
上海开阖软件有限公司 沪ICP备12045867号-1