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.

24 lines
814 B

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