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.

25 lines
935B

  1. # Copyright 2021 Tecnativa - Víctor Martínez
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo.tests import common
  4. class TestGithubConnector(common.SavepointCase):
  5. @classmethod
  6. def setUpClass(cls):
  7. super().setUpClass()
  8. cls.model = cls.env["res.partner"]
  9. cls.model._need_individual_call = False
  10. def test_partner_get_from_id_or_create(self):
  11. data = {"id": "10", "name": "Mr Odoo", "url": "https://github.com"}
  12. partner = self.model.get_from_id_or_create(data)
  13. self.assertEqual(partner.name, data["name"])
  14. # Check create process not really create new record
  15. res = self.model.get_from_id_or_create(data)
  16. self.assertEqual(partner.id, res.id)
  17. # Try to archive record and try to create again
  18. partner.active = False
  19. res = self.model.get_from_id_or_create(data)
  20. self.assertEqual(partner.id, res.id)
上海开阖软件有限公司 沪ICP备12045867号-1