forked from OCA/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] add tests for end migration scripts for newly installed modules
- Loading branch information
Showing
4 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import test_base_migration | ||
from . import test_newly_installed_end_migration |
14 changes: 14 additions & 0 deletions
14
openupgrade_scripts/scripts/base/16.0.1.3/tests/end-migration_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2023 Odoo Community Association (OCA) | ||
# Copyright 2023 Guillaume Masson <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
import logging | ||
|
||
from openupgradelib import openupgrade | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
@openupgrade.migrate(no_version=True) | ||
def migrate(env, version): | ||
params = env["ir.config_parameter"].sudo() | ||
params.set_param("openupgrade.test_end_migration", "Executed") |
10 changes: 10 additions & 0 deletions
10
openupgrade_scripts/scripts/base/16.0.1.3/tests/test_newly_installed_end_migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from odoo.tests import TransactionCase, tagged | ||
|
||
|
||
@tagged('-at_install', 'post_install') | ||
class TestNewlyInstalledEndMigration(TransactionCase): | ||
def test_newly_installed_end_migration(self): | ||
"""Make sure the code of the end-migration script has been executed""" | ||
params = self.env["ir.config_parameter"].sudo() | ||
res = params.get_param("openupgrade.test_end_migration", default="Not executed") | ||
self.assertEqual(res, "Executed") |