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

# -*- 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)