forked from michel/Coworking
[ADD]Coworker unit testing (beginning)
This commit is contained in:
parent
b00b0c96a4
commit
a9d9429b04
3
coworking_coworker/tests/__init__.py
Normal file
3
coworking_coworker/tests/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import test_coworking_coworker
|
39
coworking_coworker/tests/test_coworking_coworker.py
Normal file
39
coworking_coworker/tests/test_coworking_coworker.py
Normal file
@ -0,0 +1,39 @@
|
||||
# -*- 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 TestCoworkingCoworker(TransactionCase):
|
||||
""" Coworking cowoker testing """
|
||||
|
||||
def setUp(self, *args, **kwargs):
|
||||
""" Bootstrap testing """
|
||||
super(TestCoworkingCoworker, self).setUp(*args, **kwargs)
|
||||
data = {'name': 'Homer Simpson', 'is_coworker': True}
|
||||
self.homer = self.env['res.partner'].create(data)
|
||||
|
||||
def test_contact_date(self):
|
||||
""" Test contact date : default to today and validity """
|
||||
contact_date = fields.Date.from_string(self.homer.contact_date)
|
||||
self.assertEqual(contact_date, date.today())
|
||||
|
||||
marge = self.env['res.partner'].create({'name': 'Marge Simpson',
|
||||
'contact_date': '2017-01-01'})
|
||||
self.assertEqual(marge.contact_date, '2017-01-01')
|
||||
|
||||
with self.assertRaises(ValidationError) as err:
|
||||
data = {'name': 'Bart Simpson', 'contact_date': '2999-01-01'}
|
||||
self.env['res.partner'].create(data)
|
||||
self.assertIn('equal of inferior to', unicode(err.exception))
|
||||
|
||||
def test_full_address(self):
|
||||
""" Test full address rendering """
|
||||
pass
|
||||
|
||||
def test_manage_coworker_type(self):
|
||||
""" Test that non-coworker have not coworker_type fixed """
|
||||
pass
|
Loading…
Reference in New Issue
Block a user