From e54f70d3cc45546bb52f0f89d1c8bad6a6b426c3 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Mon, 19 Jun 2017 12:11:10 +0200 Subject: [PATCH] [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` --- odoo/addons/base/tests/test_res_config.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/odoo/addons/base/tests/test_res_config.py b/odoo/addons/base/tests/test_res_config.py index 89300bf43a5..0be7dcc7c8d 100644 --- a/odoo/addons/base/tests/test_res_config.py +++ b/odoo/addons/base/tests/test_res_config.py @@ -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()