You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.3 KiB

  1. import unittest2
  2. import openerp.tests.common as common
  3. class test_display_name(common.TransactionCase):
  4. def setUp(self):
  5. super(test_display_name,self).setUp()
  6. cr, uid = self.cr, self.uid
  7. self.res_partner = self.registry('res.partner')
  8. def test_00_create_res_partner(self):
  9. """ Test if the display name has been correctly set """
  10. cr, uid = self.cr, self.uid
  11. partner_id = self.res_partner.create(cr, uid, {'lastname': 'Lastname', 'firstname': 'Firstname', 'is_company': True})
  12. partner_records = self.res_partner.browse(cr, uid, [partner_id])
  13. p1 = partner_records[0]
  14. self.assertEqual(p1.display_name, 'Lastname Firstname', 'Partner display_name incorect')
  15. def test_01_res_partner_write_lastname(self):
  16. """ Test if the display name has been correctly set """
  17. cr, uid = self.cr, self.uid
  18. partner_id = self.res_partner.create(cr, uid, {'lastname': 'Lastname', 'firstname': 'Firstname', 'is_company': True})
  19. partner_records = self.res_partner.browse(cr, uid, [partner_id])
  20. p1 = partner_records[0]
  21. self.res_partner.write(cr, uid, partner_id, {'lastname': 'Last'})
  22. self.assertEqual(p1.display_name, 'Last Firstname', 'Partner display_name incorect')
  23. if __name__ == '__main__':
  24. unittest2.main()