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.

34 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Yannick Vaucher (Camptocamp SA)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. import openerp.tests.common as common
  5. class TestAbstractSettings(common.TransactionCase):
  6. def setUp(self):
  7. super(TestAbstractSettings, self).setUp()
  8. self.partner_id = self.ref('base.res_partner_12')
  9. self.company = self.env.ref('base.main_company')
  10. def test_config(self):
  11. wiz = self.env['a.config.settings'].create({})
  12. wiz.name = 'Toto'
  13. wiz.integer = 11
  14. wiz.partner_id = self.partner_id
  15. wiz.execute()
  16. self.assertEqual(self.company.prefix_a_name, wiz.name)
  17. self.assertEqual(self.company.prefix_a_integer, wiz.integer)
  18. self.assertEqual(self.company.prefix_a_partner_id, wiz.partner_id)
  19. def test_config_old_api(self):
  20. wiz = self.env['b.config.settings'].create({})
  21. wiz.name = 'Toto'
  22. wiz.integer = 11
  23. wiz.partner_id = self.partner_id
  24. wiz.execute()
  25. self.assertEqual(self.company.prefix_b_name, wiz.name)
  26. self.assertEqual(self.company.prefix_b_integer, wiz.integer)
  27. self.assertEqual(self.company.prefix_b_partner_id, wiz.partner_id)