Probablement un début de compréntion plus précise :)

This commit is contained in:
michel 2017-11-30 18:30:54 +01:00
parent 3cf2ff0ebc
commit 611dc6f5f4

View File

@ -15,10 +15,6 @@ class TestCoworkingCoworker(TransactionCase):
super(TestCoworkingCoworker, self).setUp(*args, **kwargs)
data = {'name': 'Homer Simpson', 'is_coworker': True}
self.homer = self.env['res.partner'].create(data)
fulladdr = {'street': '26 rue de la concorde', 'contact_zip': '87452',
'city': 'Lyon'}
self.rue = self.env['res.partner'].create(fulladdr)
def test_contact_date(self):
""" Test contact date : default to today and validity """
@ -36,11 +32,22 @@ class TestCoworkingCoworker(TransactionCase):
def test_full_address(self):
""" Test full address rendering """
full_contact_adress = fields.Char.from_string(self.rue.full_contact_adress)
self.assertEqual(full_contact_adress)
full_contact_adress = fields.from_string(self.homer.full_contact_adress)
self.assertEqual(full_contact_adress, {full_contact_adress = u'{} {} {}'.format \
(street or u'', contact_zip or u'', city or u'').strip()})
address = self.env['coworking.coworker'].create({
'street': '29 Grande rue', 'contact_zip': '26270', 'city': 'Loriol'})
fulladdr = self.env{'street': '29 Grande rue',
'contact_zip': '26270',
'city': 'Loriol'}
self.assertEqual(fulladdr.full_contact_adress, '29 Grande rue 26270 Loriol')
with self.assertRaises(ValidationError) as err:
fulladdr = {'street': '29 Grande rue',
'contact_zip': '26270',
'city': 'Loriol'}
self.env['coworking.coworker'].create(fulladdr)
self.assertIn('No full address valide', unicode(err.exception))