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.
|
|
# -*- coding: utf-8 -*- # Copyright 2017 Komit <http://komit-consulting.com> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.exceptions import ValidationError from odoo.tests.common import TransactionCase
class TestPartnerEmailCheck(TransactionCase): def setUp(self): super(TestPartnerEmailCheck, self).setUp() self.test_partner = self.env['res.partner'].create({ 'name': 'test', })
def test_bad_email(self): """Test rejection of bad emails.""" with self.assertRaises(ValidationError): self.test_partner.email = 'bad@email@domain..com'
def test_good_email(self): """Test acceptance of good""" self.test_partner.email = 'goodemail@domain.com' self.assertTrue(self.test_partner.email)
def test_bad_emails(self): """Test rejection of bad emails.""" with self.assertRaises(ValidationError): self.test_partner.email = 'good@domain.com,bad@email@domain..com'
def test_good_emails(self): """Test acceptance of good""" self.test_partner.email = 'goodemail@domain.com,goodemail2@domain.com' self.assertTrue(self.test_partner.email)
|