server-tools/database_cleanup/tests/test_purge_modules.py

28 lines
914 B
Python

# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import tagged
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCleanupPurgeLineModule(Common):
def setUp(self):
super(TestCleanupPurgeLineModule, self).setUp()
# create a nonexistent module
self.module = self.env["ir.module.module"].create(
{
"name": "database_cleanup_test",
"state": "to upgrade",
}
)
def test_remove_to_upgrade_module(self):
wizard = self.env["cleanup.purge.wizard.module"].create({})
module_names = wizard.purge_line_ids.filtered(lambda x: not x.purged).mapped(
"name"
)
self.assertTrue("database_cleanup_test" in module_names)