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.

39 lines
1.4 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. # -*- coding: utf-8 -*-
  2. import unittest2
  3. import openerp.tests.common as common
  4. class test_display_name(common.TransactionCase):
  5. def setUp(self):
  6. super(test_display_name, self).setUp()
  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, {
  12. 'lastname': 'Lastname',
  13. 'firstname': 'Firstname',
  14. 'is_company': True,
  15. })
  16. partner_records = self.res_partner.browse(cr, uid, [partner_id])
  17. p1 = partner_records[0]
  18. self.assertEqual(p1.display_name, 'Lastname Firstname', 'Partner display_name incorrect')
  19. def test_01_res_partner_write_lastname(self):
  20. """ Test if the display name has been correctly set """
  21. cr, uid = self.cr, self.uid
  22. partner_id = self.res_partner.create(cr, uid, {
  23. 'lastname': 'Lastname',
  24. 'firstname': 'Firstname',
  25. 'is_company': True
  26. })
  27. partner_records = self.res_partner.browse(cr, uid, [partner_id])
  28. p1 = partner_records[0]
  29. self.res_partner.write(cr, uid, partner_id, {'lastname': 'Last'})
  30. self.assertEqual(p1.display_name, 'Last Firstname', 'Partner display_name incorrect')
  31. if __name__ == '__main__':
  32. unittest2.main()