Coworking/coworking_relation/tests/test_coworking_relation.py

23 lines
896 B
Python

# -*- 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:
self.assertEqual('coworker1', 'coworker2')
self.env['res.partner'].create(coworker1, coworker2)
self.assertIn('Coworker1 is same coworker2', unicode(err.exception))