|
|
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> # Copyright 2018 Artyom Losev <https://it-projects.info/team/ArtyomLosev> # Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> # License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). from werkzeug import url_encode
import odoo.tests
@odoo.tests.common.at_install(True) @odoo.tests.common.post_install(True) class TestUi(odoo.tests.HttpCase): def test_01_mail_to(self): # checks the presence of an element with a link to the recipient
env = self.env # needed because tests are run before the module is marked as # installed. In js web will only load qweb coming from modules # that are returned by the backend in module_boot. Without # this you end up with js, css but no qweb. env["ir.module.module"].search( [("name", "=", "mail_to")], limit=1 ).state = "installed"
# Handle messages in Odoo res_users_ids = env["res.users"].search([]) res_users_ids.write({"notification_type": "inbox"})
# demo messages partner_ids = env["res.partner"].search([]) msg = env["mail.message"].create( { "subject": "_Test", "body": self._testMethodName, "subtype_id": self.ref("mail.mt_comment"), "model": "mail.channel", "partner_ids": [(6, 0, [i.id for i in partner_ids])], } ) # notifications for everyone for p in partner_ids.ids: env["mail.notification"].create( {"res_partner_id": p, "mail_message_id": msg.id, "is_read": False} )
link = "/web#%s" % url_encode({"action": "mail.action_discuss"}) self.phantom_js( link, "odoo.__DEBUG__.services['web_tour.tour'].run('mail_to_tour', 1000);", "odoo.__DEBUG__.services['web_tour.tour'].tours.mail_to_tour.ready", login="admin", )
|