Test recuperation de l'erreur

This commit is contained in:
michel 2017-12-05 14:06:58 +01:00
parent 95dc6a23b6
commit a600f20bbb

View File

@ -11,7 +11,7 @@ class TestCoworkingRelation(TransactionCase):
""" Coworking cowoker testing """ """ Coworking cowoker testing """
def test_if_coworker_is_same(self): def test_if_coworker_is_same(self):
""" Test coworker1 and coworker2 is identical """ """ Test coworker1.id and coworker2.id is identical """
coworker1 = self.env['res.partner'].create({'name': 'Marge Simpson', coworker1 = self.env['res.partner'].create({'name': 'Marge Simpson',
'is_coworker': True}) 'is_coworker': True})
coworker2 = self.env['res.partner'].create({'name': 'Bart Simpson', coworker2 = self.env['res.partner'].create({'name': 'Bart Simpson',
@ -22,4 +22,8 @@ class TestCoworkingRelation(TransactionCase):
'relation': 'Mère'}) 'relation': 'Mère'})
self.assertEqual(relation.relation, u'Mère') self.assertEqual(relation.relation, u'Mère')
with self.assertRaises(ValidationError) as err:
self.env['coworking.relation'].create({'coworker1': coworker1.id,
'coworker2': coworker1.id,
'relation': 'Mère'})
self.assertIn(u'Coworker1 is same coworker2', unicode(err.exception))