[ADD]Coworker full address unit testing
This commit is contained in:
parent
525dda9f04
commit
799104695f
@ -32,20 +32,21 @@ class TestCoworkingCoworker(TransactionCase):
|
||||
|
||||
def test_full_address(self):
|
||||
""" Test full address rendering """
|
||||
full_contact_adress = fields.Char.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()})
|
||||
self.homer.write({'street': False, 'zip': False, 'city': False})
|
||||
self.assertEqual(self.homer.full_contact_adress, u'')
|
||||
|
||||
fulladdr = self.env{'street': '29 Grande rue', 'contact_zip': '26270', 'city': 'Loriol'}
|
||||
self.homer.write({'street': False, 'zip': False, 'city': u'Springfield'})
|
||||
self.assertEqual(self.homer.full_contact_adress, u'Springfield')
|
||||
|
||||
self.assertEqual(fulladdr.full_contact_adress, '29 Grande rue 26270 Loriol')
|
||||
self.homer.write({'street': False, 'zip': u'5555', 'city': u'Springfield'})
|
||||
self.assertEqual(self.homer.full_contact_adress, u'5555 Springfield')
|
||||
|
||||
with self.assertRaises(ValidationError) as err:
|
||||
fulladdr = {'street': '29 Grande rue',
|
||||
'contact_zip': '26270',
|
||||
'city': 'Loriol'}
|
||||
self.env['coworking.coworker'].create(full_contact_adress)
|
||||
self.assertIn('No full address valide', unicode(err.exception))
|
||||
self.homer.write({'street': u'42 Liberty Street', 'zip': u'5555', 'city': u'Springfield'})
|
||||
self.assertEqual(self.homer.full_contact_adress,
|
||||
u'42 Liberty Street 5555 Springfield')
|
||||
|
||||
self.homer.write({'street': u'42 Liberty Street', 'zip': False, 'city': u'Springfield'})
|
||||
self.assertEqual(self.homer.full_contact_adress, u'42 Liberty Street Springfield')
|
||||
|
||||
|
||||
def test_manage_coworker_type(self):
|
||||
|
Loading…
Reference in New Issue
Block a user