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):
""" Coworking cowoker testing """
def setUp(self, *args, **kwargs):
""" Bootstrap testing """
super(TestCoworkingEvent, self).setUp(*args, **kwargs)
data = {'title': 'Mon evenement', 'is_coworker': True}
self.homer = self.env['res.partner'].create(data)
# def setUp(self, *args, **kwargs):
# """ Bootstrap testing """
# super(TestCoworkingEvent, self).setUp(*args, **kwargs)
# data = {'title': 'Mon evenement', 'is_coworker': True}
# self.homer = self.env['res.partner'].create(data)
def test_contact_date(self):
pass

View File

@ -29,5 +29,5 @@
'views/relation_menu.xml',
'views/relation_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):
""" Test coworker1 and coworker2 is identical """
coworker1 = self.env['res.partner'].create({'name': 'Marge Simpson', 'is_coworker': True})
coworker2 = self.env['res.partner'].create({'name': 'Bart Simpson', 'is_coworker': True})
self.assertNotEqual('coworker1', 'coworker2')
coworker1 = self.env['res.partner'].create({'name': 'Marge Simpson',
'is_coworker': True})
coworker2 = self.env['res.partner'].create({'name': 'Bart Simpson',
'is_coworker': True})
relation = self.env['coworking.relation'].create({'coworker1': coworker1.id,
'coworker2': coworker2.id,
'relation': 'Mère'})
self.assertEqual(relation.relation, u'Mère')
with self.assertRaises(ValidationError) as err:
self.assertEqual('coworker1', 'coworker2')
self.env['res.partner'].create(coworker1, coworker2)
self.assertIn('Coworker1 is same coworker2', unicode(err.exception))