[FIX] web_responsive: Fix test related to ir.actions.act_window

Related to cac20c5f2f

Now it is necessary to have an ir.actions.act_window record
pull/2978/head
Víctor Martínez 2024-11-04 16:38:53 +01:00
parent 6b62ffb744
commit d85a34ccc5
1 changed files with 10 additions and 19 deletions

View File

@ -1,32 +1,23 @@
# Copyright 2023 Taras Shabaranskyi
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.tests import new_test_user
from odoo.tests.common import TransactionCase
from odoo.addons.base.tests.common import BaseCommon
class TestResUsers(TransactionCase):
class TestResUsers(BaseCommon):
def test_compute_redirect_home(self):
record = self.env["res.users"].create(
record = new_test_user(self.env, login="jeant@mail.com")
self.assertFalse(record.is_redirect_home)
action = self.env["ir.actions.act_window"].create(
{
"action_id": False,
"is_redirect_home": False,
"name": "Jeant",
"login": "jeant@mail.com",
"password": "jeant@mail.com",
"name": "Test Action",
"type": "ir.actions.act_window",
"res_model": record._name,
}
)
record._compute_redirect_home()
record.action_id = action.id
self.assertFalse(record.is_redirect_home)
action_obj = self.env["ir.actions.actions"]
record.action_id = action_obj.create(
{"name": "Test Action", "type": "ir.actions.act_window"}
)
record._compute_redirect_home()
self.assertFalse(record.is_redirect_home)
record.action_id = False
record.is_redirect_home = True
record._compute_redirect_home()
self.assertTrue(record.is_redirect_home)