partner-contact/partner_second_lastname/tests/test_config.py

33 lines
1.2 KiB
Python
Raw Normal View History

2024-05-03 08:58:43 +00:00
# Copyright 2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from flectra.tests.common import TransactionCase
class TestConfig(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.wizard = cls.env["res.config.settings"].create({})
cls.partner = cls.env["res.partner"].create(
{"firstname": "First", "lastname": "Last", "lastname2": "Second"}
)
def test_last_first(self):
self.wizard.partner_names_order = "last_first"
self.wizard.set_values()
self.wizard.action_recalculate_partners_name()
self.assertEqual(self.partner.name, "Last Second First")
def test_last_first_comma(self):
self.wizard.partner_names_order = "last_first_comma"
self.wizard.set_values()
self.wizard.action_recalculate_partners_name()
self.assertEqual(self.partner.name, "Last Second, First")
def test_first_last(self):
self.wizard.partner_names_order = "first_last"
self.wizard.set_values()
self.wizard.action_recalculate_partners_name()
self.assertEqual(self.partner.name, "First Last Second")