def test_callback_channel(): with mock.patch.object(sanic.Sanic, "run", fake_sanic_run): # START DOC INCLUDE from rasa.core.channels.callback import CallbackInput 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 = CallbackInput( # URL Core will call to send the bot responses endpoint=EndpointConfig("http://localhost:5004") ) 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("callback_webhook.health").startswith( "/webhooks/callback" ) assert routes_list.get("callback_webhook.webhook").startswith( "/webhooks/callback/webhook" )
def test_callback_channel(): # START DOC INCLUDE from rasa.core.channels.callback import CallbackInput input_channel = CallbackInput( # URL Core will call to send the bot responses endpoint=EndpointConfig("http://localhost:5004")) 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["callback_webhook.health"].startswith( "/webhooks/callback") assert routes_list["callback_webhook.webhook"].startswith( "/webhooks/callback/webhook")