Skip to content

Commit

Permalink
[MIG] pos_access_right: Migration to 16.0 - unit test pos access right.
Browse files Browse the repository at this point in the history
  • Loading branch information
jumeldi74 committed Jun 1, 2023
1 parent f776bd9 commit 0be2095
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions pos_access_right/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import test_pos_access_right
from . import test_load_ui
18 changes: 18 additions & 0 deletions pos_access_right/tests/test_load_ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from odoo.tests import HttpCase, tagged


@tagged("post_install", "-at_install")
class TestLoadUI(HttpCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
env = cls.env(user=cls.env.ref("base.user_admin"))
cls.main_pos_config = env.ref("point_of_sale.pos_config_main")

def test_pos_js(self):
# open a session, the /pos/ui controller will redirect to it
self.main_pos_config.open_ui()
self.main_pos_config.write({"module_pos_hr": True})

# point_of_sale desktop test suite
self.browser_js("/pos/ui/tests?mod=web", "", "", login="admin", timeout=1800)
10 changes: 3 additions & 7 deletions pos_access_right/tests/test_pos_access_right.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from odoo.tests import TransactionCase, tagged
from odoo.tests import TransactionCase

# from odoo.addons.pos_hr.tests.test_frontend import TestPosHrHttpCommon


class TestUserRestriction(TransactionCase):
Expand All @@ -23,7 +25,6 @@ def setUpClass(cls):
{"name": "pos_emp", "user_id": cls.pos_user.id}
)
cls.pos_config_main = cls.env.ref("point_of_sale.pos_config_main")
cls.pos_config_main.write({"module_pos_hr": True})

def test_access_pos(self):
self.pos_config_main._compute_groups()
Expand Down Expand Up @@ -64,9 +65,4 @@ def test_access_pos(self):

self.group_payment = self.env.ref("pos_access_right.group_payment")
self.assertEqual(self.group_payment, self.pos_config_main.group_payment_id)


@tagged("post_install", "-at_install")
class TestUI(TestUserRestriction):
def test_01_load_employee(self):
self.pos_config_main.open_ui()

0 comments on commit 0be2095

Please sign in to comment.