From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- addons/website_livechat/controllers/test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 addons/website_livechat/controllers/test.py (limited to 'addons/website_livechat/controllers/test.py') diff --git a/addons/website_livechat/controllers/test.py b/addons/website_livechat/controllers/test.py new file mode 100644 index 00000000..0ecabd66 --- /dev/null +++ b/addons/website_livechat/controllers/test.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.http import Controller, request, route + + +class TestBusController(Controller): + """ + This controller is only useful for test purpose. Bus is unavailable in test mode, but there is no way to know, + at client side, if we are running in test mode or not. This route can be called while running tours to mock + some behaviour in function of the test mode status (activated or not). + + E.g. : To test the livechat and to check there is no duplicates in message displayed in the chatter, + in test mode, we need to mock a 'message added' notification that is normally triggered by the bus. + In Normal mode, the bus triggers itself the notification. + """ + @route('/bus/test_mode_activated', type="json", auth="public") + def is_test_mode_activated(self): + return request.registry.in_test_mode() -- cgit v1.2.3