[IMP] base: Add a test on res_config on page loading and saving

Try to create and execute all res_config models. Target settings that can't be
loaded or saved and avoid remaining methods `get_default_foo` or `set_foo` that
won't be executed is foo != `fields`
This commit is contained in:
Yannick Tivisse
2017-06-19 17:37:38 +02:00
parent 100f320217
commit e54f70d3cc
+20
View File
@@ -1,10 +1,14 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from odoo import exceptions
from odoo.tests.common import TransactionCase
from odoo.tools import pycompat
_logger = logging.getLogger(__name__)
class TestResConfig(TransactionCase):
@@ -79,3 +83,19 @@ class TestResConfig(TransactionCase):
# Check returned value
self.assertEqual(res.args[0], self.expected_final_error_msg_wo_menu)
class TestResConfigExecute(TransactionCase):
at_install = False
post_install = True
def test_01_execute_res_config(self):
"""
Try to create and execute all res_config models. Target settings that can't be
loaded or saved and avoid remaining methods `get_default_foo` or `set_foo` that
won't be executed is foo != `fields`
"""
all_config_settings = self.env['ir.model'].search([('name', 'like', 'config.settings')])
for config_settings in all_config_settings:
_logger.info("Testing %s" % (config_settings.name))
self.env[config_settings.name].create({}).execute()