test.py 930 B

1234567891011121314151617181920
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo.http import Controller, request, route
  4. class TestBusController(Controller):
  5. """
  6. This controller is only useful for test purpose. Bus is unavailable in test mode, but there is no way to know,
  7. at client side, if we are running in test mode or not. This route can be called while running tours to mock
  8. some behaviour in function of the test mode status (activated or not).
  9. E.g. : To test the livechat and to check there is no duplicates in message displayed in the chatter,
  10. in test mode, we need to mock a 'message added' notification that is normally triggered by the bus.
  11. In Normal mode, the bus triggers itself the notification.
  12. """
  13. @route('/bus/test_mode_activated', type="json", auth="public")
  14. def is_test_mode_activated(self):
  15. return request.registry.in_test_mode()