Files
odoo_source/addons/website/tests/test_controllers.py
T
DramixDw 9b9829416b [IMP] website: simplify website menu
Some apps, once installed, automatically create a menuitem in website.
What complexify the UI and create useless menu withtout plusvalue.

It is not because you install livechat to make support online, that you want
a link in your menu to show stats e.g.

Now we remove the default menu created, and help user to find it when he create
a link. The autocomplete suggest most of the main App's controllers

task-2189613

closes odoo/odoo#49081

Related: odoo/enterprise#9733
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-05-01 07:59:07 +00:00

45 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
from odoo import tests
from odoo.tools import mute_logger
@tests.tagged('post_install', '-at_install')
class TestControllers(tests.HttpCase):
@mute_logger('odoo.addons.http_routing.models.ir_http', 'odoo.http')
def test_last_created_pages_autocompletion(self):
self.authenticate("admin", "admin")
Page = self.env['website.page']
last_5_url_edited = []
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
suggested_links_url = base_url + '/website/get_suggested_links'
for i in range(0, 10):
new_page = Page.create({
'name': 'Generic',
'type': 'qweb',
'arch': '''
<div>content</div>
''',
'key': "test.generic_view-%d" % i,
'url': "/generic-%d" % i,
'is_published': True,
})
if i % 2 == 0:
# mark as old
new_page._write({'write_date': '2020-01-01'})
else:
last_5_url_edited.append(new_page.url)
res = self.opener.post(url=suggested_links_url, json={'params': {'needle': '/'}})
resp = json.loads(res.content)
assert 'result' in resp
suggested_links = resp['result']
last_modified_history = next(o for o in suggested_links['others'] if o["title"] == "Last modified pages")
last_modified_values = map(lambda o: o['value'], last_modified_history['values'])
self.assertTrue(set(last_modified_values) == set(last_5_url_edited))