Ajout du test d'erreurs
This commit is contained in:
parent
58d6dec996
commit
6685e4e369
@ -31,19 +31,27 @@ class TestCoworkingCoworker(TransactionCase):
|
||||
self.assertIn('equal of inferior to', unicode(err.exception))
|
||||
|
||||
def test_full_address(self):
|
||||
""" Test full address rendering """
|
||||
full_contact_adress = fields.Char.from_string(self.homer.full_contact_adress)
|
||||
self.homer.write({'street': False, 'zip': False, 'city': False})
|
||||
self.assertEqual(self.homer.full_contact_adress, u'')
|
||||
|
||||
full_address = self.env{'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(full_address.full_contact_adress, '26270 Loriol')
|
||||
self.homer.write({'street': False, 'zip': u'5555', 'city': u'Springfield'})
|
||||
self.assertEqual(self.homer.full_contact_adress, u'5555 Springfield')
|
||||
|
||||
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')
|
||||
|
||||
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': False, 'zip': False, 'city': False})
|
||||
self.assertEqual(self.homer.full_contact_adress, u'Springfield')
|
||||
|
||||
self.assertIn('Full adresse is broken', unicode(err.exception))
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user