def test_rocketchat_channel(): with mock.patch.object(sanic.Sanic, "run", fake_sanic_run): # START DOC INCLUDE from rasa.core.channels.rocketchat import RocketChatInput from rasa.core.agent import Agent from rasa.core.interpreter import RegexInterpreter # load your trained agent agent = Agent.load(MODEL_PATH, interpreter=RegexInterpreter()) input_channel = RocketChatInput( # your bots rocket chat user name user="******", # the password for your rocket chat bots account password="******", # url where your rocket chat instance is running server_url="https://demo.rocket.chat", ) s = agent.handle_channels([input_channel], 5004) # END DOC INCLUDE # the above marker marks the end of the code snipped included # in the docs routes_list = utils.list_routes(s) assert routes_list.get("rocketchat_webhook.health").startswith( "/webhooks/rocketchat") assert routes_list.get("rocketchat_webhook.webhook").startswith( "/webhooks/rocketchat/webhook")
def test_rocketchat_channel(): # START DOC INCLUDE from rasa.core.channels.rocketchat import RocketChatInput input_channel = RocketChatInput( # your bots rocket chat user name user="******", # the password for your rocket chat bots account password="******", # url where your rocket chat instance is running server_url="https://demo.rocket.chat", ) s = rasa.core.run.configure_app([input_channel], port=5004) # END DOC INCLUDE # the above marker marks the end of the code snipped included # in the docs routes_list = utils.list_routes(s) assert routes_list["rocketchat_webhook.health"].startswith( "/webhooks/rocketchat") assert routes_list["rocketchat_webhook.webhook"].startswith( "/webhooks/rocketchat/webhook")