Browse Source

Test relation

V5_unit_test
michel 2 years ago
parent
commit
95dc6a23b6
3 changed files with 16 additions and 13 deletions
  1. +5
    -5
      coworking_event/tests/test_coworking_event.py
  2. +1
    -1
      coworking_relation/__manifest__.py
  3. +10
    -7
      coworking_relation/tests/test_coworking_relation.py

+ 5
- 5
coworking_event/tests/test_coworking_event.py 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

+ 1
- 1
coworking_relation/__manifest__.py 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']
}

+ 10
- 7
coworking_relation/tests/test_coworking_relation.py 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})

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))
relation = self.env['coworking.relation'].create({'coworker1': coworker1.id,
'coworker2': coworker2.id,
'relation': 'Mère'})
self.assertEqual(relation.relation, u'Mère')


Loading…
Cancel
Save