-
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.
Signed-off-by pedrobaeza
- Loading branch information
Showing
1 changed file
with
10 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
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() | ||
record.action_id = action.id | ||
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) |