Exemplo n.º 1
0
def test_webexteams_channel():
    with mock.patch.object(sanic.Sanic, "run", fake_sanic_run):
        # START DOC INCLUDE
        from rasa.core.channels.webexteams import WebexTeamsInput
        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 = WebexTeamsInput(
            access_token="YOUR_ACCESS_TOKEN",
            # this is the `bot access token`
            room="YOUR_WEBEX_ROOM"
            # the name of your channel to which the bot posts (optional)
        )

        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("webexteams_webhook.health").startswith(
            "/webhooks/webexteams")
        assert routes_list.get("webexteams_webhook.webhook").startswith(
            "/webhooks/webexteams/webhook")
Exemplo n.º 2
0
def test_webexteams_channel():
    # START DOC INCLUDE
    from rasa.core.channels.webexteams import WebexTeamsInput

    input_channel = WebexTeamsInput(
        access_token="YOUR_ACCESS_TOKEN",
        # this is the `bot access token`
        room="YOUR_WEBEX_ROOM"
        # the name of your channel to which the bot posts (optional)
    )

    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["webexteams_webhook.health"].startswith(
        "/webhooks/webexteams")
    assert routes_list["webexteams_webhook.webhook"].startswith(
        "/webhooks/webexteams/webhook")