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.

27 lines
855 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016-2017 LasLabs Inc.
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo.tests.common import TransactionCase
  5. from odoo.exceptions import ValidationError
  6. from psycopg2 import IntegrityError
  7. class TestPartnerAlias(TransactionCase):
  8. def setUp(self):
  9. super(TestPartnerAlias, self).setUp()
  10. self.alias_1 = self.env.ref(
  11. 'partner_alias.res_partner_alias_alias_1'
  12. )
  13. def test_check_name(self):
  14. """ Test raise ValidationError if alias name same as partner """
  15. with self.assertRaises(ValidationError):
  16. self.alias_1.firstname = 'Malcom'
  17. def test_unique_name(self):
  18. """ Test raises IntegrityError is name not unique """
  19. with self.assertRaises(IntegrityError):
  20. self.alias_1.firstname = 'Greg'