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.

71 lines
2.6 KiB

  1. # -*- coding: utf-8 -*-
  2. # Authors: Nemry Jonathan
  3. # Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
  4. # All Rights Reserved
  5. #
  6. # WARNING: This program as such is intended to be used by professional
  7. # programmers who take the whole responsibility of assessing all potential
  8. # consequences resulting from its eventual inadequacies and bugs.
  9. # End users who are looking for a ready-to-use solution with commercial
  10. # guarantees and support are strongly advised to contact a Free Software
  11. # Service Company.
  12. #
  13. # This program is Free Software; you can redistribute it and/or
  14. # modify it under the terms of the GNU General Public License
  15. # as published by the Free Software Foundation; either version 2
  16. # of the License, or (at your option) any later version.
  17. #
  18. # This program is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. # GNU General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License
  24. # along with this program; if not, write to the Free Software
  25. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  26. from .base import BaseCase
  27. class PartnerContactCase(BaseCase):
  28. def test_update_lastname(self):
  29. """Change lastname."""
  30. self.expect(u"newlästname", self.firstname)
  31. self.original.name = self.name
  32. def test_update_firstname(self):
  33. """Change firstname."""
  34. self.expect(self.lastname, u"newfïrstname")
  35. self.original.name = self.name
  36. def test_whitespace_cleanup(self):
  37. """Check that whitespace in name gets cleared."""
  38. self.expect(u"newlästname", u"newfïrstname")
  39. self.original.name = " newlästname newfïrstname "
  40. # Need this to refresh the ``name`` field
  41. self.original.invalidate_cache()
  42. class PartnerCompanyCase(BaseCase):
  43. def create_original(self):
  44. super(PartnerCompanyCase, self).create_original()
  45. self.original.is_company = True
  46. def test_copy(self):
  47. super(PartnerCompanyCase, self).test_copy()
  48. self.expect(self.name, False, self.name)
  49. def test_company_inverse(self):
  50. """Test the inverse method in a company record."""
  51. name = u"Thïs is a Companŷ"
  52. self.expect(name, False, name)
  53. self.original.name = name
  54. class UserCase(PartnerContactCase):
  55. def create_original(self):
  56. self.original = self.env["res.users"].create({
  57. "name": u"%s %s" % (self.lastname, self.firstname),
  58. "login": "firstnametest@example.com"})