test_res_config.py 829 B

12345678910111213141516171819
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from unittest.mock import patch
  4. from odoo.tests.common import TransactionCase
  5. class TestResConfig(TransactionCase):
  6. def test_00_add_parameter_with_default_value(self):
  7. """ Check if parameters with a default value are saved in the ir_config_parameter table """
  8. self.env['res.config.test'].create({}).execute()
  9. self.assertEqual(self.env['ir.config_parameter'].sudo().get_param('resConfigTest.parameter1'), str(1000),
  10. "The parameter is not saved with its default value")
  11. with patch('odoo.addons.base.models.ir_config_parameter.IrConfigParameter.set_param') as set_param_mock:
  12. self.env['res.config.test'].create({}).execute()
  13. set_param_mock.assert_not_called()