2017-12-04 15:54:30 +01:00
|
|
|
# -*- 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):
|
2017-12-05 14:06:58 +01:00
|
|
|
""" Test coworker1.id and coworker2.id is identical """
|
2017-12-05 12:46:36 +01:00
|
|
|
coworker1 = self.env['res.partner'].create({'name': 'Marge Simpson',
|
|
|
|
'is_coworker': True})
|
|
|
|
coworker2 = self.env['res.partner'].create({'name': 'Bart Simpson',
|
|
|
|
'is_coworker': True})
|
2017-12-04 15:54:30 +01:00
|
|
|
|
2017-12-05 12:46:36 +01:00
|
|
|
relation = self.env['coworking.relation'].create({'coworker1': coworker1.id,
|
|
|
|
'coworker2': coworker2.id,
|
|
|
|
'relation': 'Mère'})
|
|
|
|
self.assertEqual(relation.relation, u'Mère')
|
|
|
|
|
2017-12-05 14:06:58 +01:00
|
|
|
with self.assertRaises(ValidationError) as err:
|
|
|
|
self.env['coworking.relation'].create({'coworker1': coworker1.id,
|
|
|
|
'coworker2': coworker1.id,
|
|
|
|
'relation': 'Mère'})
|
|
|
|
self.assertIn(u'Coworker1 is same coworker2', unicode(err.exception))
|