From 624387b89d2c9b7e1658cf7c6fda81695b4723cd Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Wed, 4 May 2022 15:22:18 +0200 Subject: [PATCH] [FIX] correct name for custom script in execute_script tests --- .../tools_odoo_instance.py | 1 - tests/cli_B_04_execute_script_test.py | 4 +- .../post-migration-custom_test.py | 39 +++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 tests/extra_script_B/post-migration-custom_test.py diff --git a/odoo_openupgrade_wizard/tools_odoo_instance.py b/odoo_openupgrade_wizard/tools_odoo_instance.py index 9e1e1b7..2027cdb 100644 --- a/odoo_openupgrade_wizard/tools_odoo_instance.py +++ b/odoo_openupgrade_wizard/tools_odoo_instance.py @@ -18,7 +18,6 @@ class OdooInstance: env = False version = False - # constructeur de la classe def __init__(self, ctx, database): # # TODO, improve me waith for response on http://localhost:port # # with a time out diff --git a/tests/cli_B_04_execute_script_test.py b/tests/cli_B_04_execute_script_test.py index f94c184..5f04081 100644 --- a/tests/cli_B_04_execute_script_test.py +++ b/tests/cli_B_04_execute_script_test.py @@ -6,7 +6,9 @@ from . import cli_runner_invoke def test_cli_execute_script(): output_folder_path = Path("./tests/output_B") - extra_script_path = Path("./tests/extra_script_B/post-migration-custom.py") + extra_script_path = Path( + "./tests/extra_script_B/post-migration-custom_test.py" + ) db_name = "database_test_cli_execute_script" diff --git a/tests/extra_script_B/post-migration-custom_test.py b/tests/extra_script_B/post-migration-custom_test.py new file mode 100644 index 0000000..a0842c5 --- /dev/null +++ b/tests/extra_script_B/post-migration-custom_test.py @@ -0,0 +1,39 @@ +def main(self): + + # Classic ORM usage Checks + partners = self.browse_by_search("res.partner") + + self.browse_by_create("res.partner", {"name": "New Partner"}) + + new_partners = self.browse_by_search("res.partner") + + if len(partners) + 1 != len(new_partners): + raise Exception("Creation of partner failed.") + + # Install / uninstall modules checks + if self.check_modules_installed("sale"): + self.uninstall_modules("sale") + + self.install_modules("sale") + + if not self.check_modules_installed("sale"): + raise Exception("'sale' module should be installed") + + self.uninstall_modules(["product"]) + + if self.check_modules_installed("sale"): + raise Exception( + "'sale' module should not be installed" + " after uninstallation of product" + ) + + # models checks + if not self.check_models_present("res.partner"): + raise Exception("'res.partner' model should be present.") + + if self.check_models_present("res.partner.unexisting.model"): + raise Exception( + "'res.partner.unexisting.model' model" " should not be present." + ) + + #