mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] use key/value pair for support branding
This commit is contained in:
@@ -25,42 +25,31 @@ class TestSupportBranding(TransactionCase):
|
||||
# Check if user has the right access rights e.g. portal user not allowed
|
||||
with self.assertRaises(AccessError):
|
||||
self.ir_config_obj.with_user(self.portal_user).get_param(
|
||||
self.demo_support_company_branding_url.key
|
||||
self.demo_support_branding_company_name.key
|
||||
)
|
||||
|
||||
# Check if demo user is able to access.
|
||||
# NB: ir.config_parameter model requires admin access rights.
|
||||
with self.assertRaises(AccessError):
|
||||
self.ir_config_obj.with_user(self.demo_user).get_param(
|
||||
self.demo_support_company_branding_url.key
|
||||
self.demo_support_branding_company_name.key
|
||||
)
|
||||
|
||||
value = self.company_obj.with_user(self.demo_user).get_ir_config_param_data(
|
||||
self.demo_support_company_branding_url.key
|
||||
)
|
||||
vals = self.company_obj.with_user(
|
||||
self.demo_user).get_support_branding_config_param_data()
|
||||
|
||||
self.assertEquals(value, self.demo_support_company_branding_url.value)
|
||||
self.assertEquals(vals['support_company'],
|
||||
self.demo_support_branding_company_name.value)
|
||||
|
||||
# Check if admin user is able to access
|
||||
# admin has access all through
|
||||
value_1 = self.company_obj.with_user(self.admin_user).get_ir_config_param_data(
|
||||
self.demo_support_company_branding_url.key
|
||||
)
|
||||
value_2 = self.company_obj.with_user(self.admin_user).get_ir_config_param_data(
|
||||
self.demo_support_company_branding_url.key
|
||||
)
|
||||
self.assertEquals(value_1, value_2)
|
||||
self.assertEquals(value_1, self.demo_support_company_branding_url.value)
|
||||
self.assertEquals(value_2, self.demo_support_company_branding_url.value)
|
||||
vals_1 = self.company_obj.with_user(
|
||||
self.admin_user).get_support_branding_config_param_data()
|
||||
vals_2 = self.company_obj.with_user(
|
||||
self.admin_user).get_support_branding_config_param_data()
|
||||
self.assertEquals(vals_1, vals_2)
|
||||
self.assertEquals(vals_1['support_company_url'],
|
||||
self.demo_support_company_branding_url.value)
|
||||
self.assertEquals(vals_2['support_company_url'],
|
||||
self.demo_support_company_branding_url.value)
|
||||
|
||||
# check if return if key is invalid
|
||||
empty_val = self.company_obj.with_user(
|
||||
self.admin_user
|
||||
).get_ir_config_param_data("testing")
|
||||
self.assertEquals(empty_val, "")
|
||||
|
||||
# check if return of key if invalid
|
||||
with self.assertRaises(UserError):
|
||||
empty_val = self.company_obj.with_user(
|
||||
self.admin_user
|
||||
).get_ir_config_param_data(True)
|
||||
|
||||
Reference in New Issue
Block a user