Debut des test relation sur check_if_coworker_is_same

This commit is contained in:
michel 2017-12-04 15:54:30 +01:00
parent 34efb13093
commit 0e5b176930
3 changed files with 30 additions and 3 deletions

View File

@ -12,9 +12,9 @@ class TestCoworkingEvent(TransactionCase):
def setUp(self, *args, **kwargs): def setUp(self, *args, **kwargs):
""" Bootstrap testing """ """ Bootstrap testing """
super(TestCoworkingCoworker, self).setUp(*args, **kwargs) super(TestCoworkingEvent, self).setUp(*args, **kwargs)
data = {'name': 'Homer Simpson', '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

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import test_coworking_relation

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
""" Coworking cowoker testing module """
from datetime import date
from odoo import fields
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
class TestCoworkingRelation(TransactionCase):
""" Coworking cowoker testing """
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')
with self.assertRaises(ValidationError) as err:
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.assertEqual('coworker1', 'coworker2')
self.env['res.partner'].create(coworker1, coworker2)
self.assertIn('Coworker1 is same coworker2', unicode(err.exception))