forked from OCA/wms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_user_config_service.py
32 lines (29 loc) · 1.13 KB
/
test_user_config_service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright 2020 Camptocamp SA (http://www.camptocamp.com)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from .common import CommonCase
class AppCase(CommonCase):
@classmethod
def setUpClassVars(cls):
super().setUpClassVars()
cls.profile = cls.env.ref("shopfloor_base.profile_demo_1")
cls.profile2 = cls.env.ref("shopfloor_base.profile_demo_2")
return
def test_user_config(self):
"""Request /app/user_config"""
# Simulate the client asking the configuration
service = self.get_service("app", profile=self.profile)
response = service.dispatch("user_config")
profiles = self.env["shopfloor.profile"].search([])
self.assert_response(
response,
data={
"profiles": [
{"id": profile.id, "name": profile.name} for profile in profiles
],
"user_info": {
"id": self.env.user.id,
"name": self.env.user.name,
"lang": self.env.user.lang.replace("_", "-"),
},
},
)