Since changes made in https://github.com/odoo/enterprise/pull/41117 we cannot provide icons for menus in an other format than png. As it was allowed before to use SVG, we don't want to restrict to only one format. Before, it was trying to gess the mimetype based on the image content which is not also the best case. So as the icon is a binary field store=True, we can just take the mimetype from the attachment. closes odoo/odoo#122580 X-original-commit: 044e6b680bc988708a9bbcc3c93dabf787c4a190 Related: odoo/enterprise#41529 Signed-off-by: Masereel Pierre <pim@odoo.com>
55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
from odoo.tests.common import HttpCase
|
|
|
|
class LoadMenusTests(HttpCase):
|
|
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.menu = self.env["ir.ui.menu"].create({
|
|
"name": "test_menu",
|
|
"parent_id": False,
|
|
})
|
|
|
|
def search(*args, **kwargs):
|
|
return self.menu
|
|
|
|
self.patch(type(self.env["ir.ui.menu"]), "search", search)
|
|
self.authenticate("admin", "admin")
|
|
|
|
def test_load_menus(self):
|
|
menu_loaded = self.url_open("/web/webclient/load_menus/1234")
|
|
expected = {
|
|
str(self.menu.id): {
|
|
"actionID": False,
|
|
"actionModel": False,
|
|
"appID": self.menu.id,
|
|
"children": [],
|
|
"id": self.menu.id,
|
|
"name": "test_menu",
|
|
"webIcon": False,
|
|
"webIconData": False,
|
|
"webIconDataMimetype": False,
|
|
"xmlid": ""
|
|
},
|
|
"root": {
|
|
"actionID": False,
|
|
"actionModel": False,
|
|
"appID": False,
|
|
"children": [
|
|
self.menu.id,
|
|
],
|
|
"id": "root",
|
|
"name": "root",
|
|
"webIcon": None,
|
|
"webIconData": None,
|
|
"webIconDataMimetype": None,
|
|
"xmlid": "",
|
|
"backgroundImage": None,
|
|
}
|
|
}
|
|
|
|
self.assertDictEqual(
|
|
menu_loaded.json(),
|
|
expected,
|
|
"load_menus didn't return the expected value"
|
|
)
|