From 611dc6f5f416f649f1dc05280e0e1dc8a50375f3 Mon Sep 17 00:00:00 2001 From: michel Date: Thu, 30 Nov 2017 18:30:54 +0100 Subject: [PATCH] =?UTF-8?q?Probablement=20un=20d=C3=A9but=20de=20compr?= =?UTF-8?q?=C3=A9ntion=20plus=20pr=C3=A9cise=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/test_coworking_coworker.py | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/coworking_coworker/tests/test_coworking_coworker.py b/coworking_coworker/tests/test_coworking_coworker.py index 05c37f1..d976828 100644 --- a/coworking_coworker/tests/test_coworking_coworker.py +++ b/coworking_coworker/tests/test_coworking_coworker.py @@ -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,12 +32,23 @@ 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()}) + + 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)) - address = self.env['coworking.coworker'].create({ - 'street': '29 Grande rue', 'contact_zip': '26270', 'city': 'Loriol'}) - def test_manage_coworker_type(self):