summaryrefslogtreecommitdiff
path: root/addons/website_livechat/controllers/test.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/website_livechat/controllers/test.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/website_livechat/controllers/test.py')
-rw-r--r--addons/website_livechat/controllers/test.py19
1 files changed, 19 insertions, 0 deletions
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()