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.

23 lines
792 B

  1. # Copyright 2019 Komit <https://komit-consulting.com>
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo.exceptions import ValidationError
  4. from odoo.tests.common import TransactionCase
  5. class TestPartnerEmailCheck(TransactionCase):
  6. def setUp(self):
  7. super(TestPartnerEmailCheck, self).setUp()
  8. self.test_partner = self.env['res.partner'].create({
  9. 'name': 'test',
  10. })
  11. def test_bad_email(self):
  12. """Test rejection of bad emails."""
  13. with self.assertRaises(ValidationError):
  14. self.test_partner.email = 'bad@email@domain..com'
  15. def test_good_email(self):
  16. """Test acceptance of good"""
  17. self.test_partner.email = 'goodemail@domain.com'
  18. self.assertTrue(self.test_partner.email)