Test relation

This commit is contained in:
michel 2017-12-05 12:46:36 +01:00
parent 22134ca9ee
commit 95dc6a23b6
3 changed files with 16 additions and 13 deletions

View File

@ -10,11 +10,11 @@ from odoo.tests.common import TransactionCase
class TestCoworkingEvent(TransactionCase): class TestCoworkingEvent(TransactionCase):
""" Coworking cowoker testing """ """ Coworking cowoker testing """
def setUp(self, *args, **kwargs): # def setUp(self, *args, **kwargs):
""" Bootstrap testing """ # """ Bootstrap testing """
super(TestCoworkingEvent, self).setUp(*args, **kwargs) # super(TestCoworkingEvent, self).setUp(*args, **kwargs)
data = {'title': 'Mon evenement', 'is_coworker': True} # data = {'title': 'Mon evenement', 'is_coworker': True}
self.homer = self.env['res.partner'].create(data) # self.homer = self.env['res.partner'].create(data)
def test_contact_date(self): def test_contact_date(self):
pass pass

View File

@ -29,5 +29,5 @@
'views/relation_menu.xml', 'views/relation_menu.xml',
'views/relation_views.xml', 'views/relation_views.xml',
'views/res_partner_views.xml'], 'views/res_partner_views.xml'],
'depends': ['coworking_coworker'] 'depends': ['coworking_coworker', 'coworking_event']
} }

View File

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