From 95dc6a23b6ff4f3d3e8c5cac7f14bfcc5f3af7a7 Mon Sep 17 00:00:00 2001 From: michel Date: Tue, 5 Dec 2017 12:46:36 +0100 Subject: [PATCH] Test relation --- coworking_event/tests/test_coworking_event.py | 10 +++++----- coworking_relation/__manifest__.py | 2 +- .../tests/test_coworking_relation.py | 17 ++++++++++------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/coworking_event/tests/test_coworking_event.py b/coworking_event/tests/test_coworking_event.py index 986a848..34bbdfb 100644 --- a/coworking_event/tests/test_coworking_event.py +++ b/coworking_event/tests/test_coworking_event.py @@ -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 diff --git a/coworking_relation/__manifest__.py b/coworking_relation/__manifest__.py index 0cd6cf9..b6ec55e 100644 --- a/coworking_relation/__manifest__.py +++ b/coworking_relation/__manifest__.py @@ -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'] } diff --git a/coworking_relation/tests/test_coworking_relation.py b/coworking_relation/tests/test_coworking_relation.py index 6cbf7ea..1588a2a 100644 --- a/coworking_relation/tests/test_coworking_relation.py +++ b/coworking_relation/tests/test_coworking_relation.py @@ -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') + +