mirror of
https://github.com/bringout/oca-ocb-test.git
synced 2026-04-22 19:22:08 +02:00
19.0 vanilla
This commit is contained in:
parent
38c6088dcc
commit
d9452d2060
243 changed files with 30797 additions and 10815 deletions
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
from lxml import html
|
||||
|
||||
from odoo.addons.website.tools import MockRequest
|
||||
from odoo.tests import tagged, HttpCase
|
||||
|
||||
|
||||
|
|
@ -21,6 +20,9 @@ class TestWebsiteMenu(HttpCase):
|
|||
controller_url = '/test_website/model_item/'
|
||||
website = self.env['website'].browse(1)
|
||||
|
||||
# First render to fill the cache.
|
||||
self.url_open(f"{controller_url}{records[0].id}")
|
||||
|
||||
self.env['website.menu'].create([{
|
||||
'name': records[0].name,
|
||||
'url': f"{controller_url}{records[0].id}",
|
||||
|
|
@ -36,10 +38,6 @@ class TestWebsiteMenu(HttpCase):
|
|||
}])
|
||||
for record in records:
|
||||
record_url = f"{controller_url}{record.id}"
|
||||
with MockRequest(self.env, website=website, url_root='', path=record_url):
|
||||
tree = html.fromstring(self.env['ir.qweb']._render('test_website.model_item', {
|
||||
'record': record,
|
||||
'main_object': record,
|
||||
}))
|
||||
menu_link_el = tree.xpath(".//*[@id='top_menu']//a[@href='%s' and contains(@class, 'active')]" % record_url)
|
||||
self.assertEqual(len(menu_link_el), 1, "The menu link related to the current record should be active")
|
||||
tree = html.fromstring(self.url_open(record_url).content)
|
||||
menu_link_el = tree.xpath(".//*[@id='top_menu']//a[@href='%s' and hasclass('active')]" % record_url)
|
||||
self.assertEqual(len(menu_link_el), 1, "The menu link related to the current record should be active")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue