Ejemplo n.º 1
0
        (Restarted(), None),
        (AllSlotsReset(), None),
        (ConversationPaused(), None),
        (ConversationResumed(), None),
        (StoryExported(), None),
        (ActionReverted(), None),
        (UserUtteranceReverted(), None),
        (SessionStarted(), None),
        (ActionExecuted("my_action"), ActionExecuted("my_other_action")),
        (FollowupAction("my_action"), FollowupAction("my_other_action")),
        (
            BotUttered("my_text", {"my_data": 1}),
            BotUttered("my_other_test", {"my_other_data": 1}),
        ),
        (
            AgentUttered("my_text", "my_data"),
            AgentUttered("my_other_test", "my_other_data"),
        ),
        (
            ReminderScheduled("my_intent", datetime.now()),
            ReminderScheduled("my_other_intent", datetime.now()),
        ),
    ],
)
def test_event_has_proper_implementation(one_event, another_event):
    # equals tests
    assert (
        one_event != another_event
    ), "Same events with different values need to be different"
    assert one_event == copy.deepcopy(one_event), "Event copies need to be the same"
    assert one_event != 42, "Events aren't equal to 42!"
Ejemplo n.º 2
0
def test_json_parse_agent():
    evt = {"event": "agent", "text": "Hey, how are you?"}
    assert Event.from_parameters(evt) == AgentUttered("Hey, how are you?")
Ejemplo n.º 3
0
                                "confidence": 0.9618658423423767,
                                "intent_response_key": "chitchat/ask_name",
                            },
                            {
                                "id": 8392727822750416828,
                                "confidence": 0.03813415765762329,
                                "intent_response_key": "chitchat/ask_weather",
                            },
                        ],
                    },
                },
            },
        ),
        SessionStarted(),
        ActionExecuted(action_name="action_listen"),
        AgentUttered(),
    ),
)
async def test_remote_action_valid_payload_all_events(
    default_channel: OutputChannel,
    default_nlg: NaturalLanguageGenerator,
    default_tracker: DialogueStateTracker,
    domain: Domain,
    event: Event,
):
    endpoint = EndpointConfig("https://example.com/webhooks/actions")
    remote_action = action.RemoteAction("my_action", endpoint)
    events = [event.as_dict()]
    response = {"events": events, "responses": []}
    with aioresponses() as mocked:
        mocked.post("https://example.com/webhooks/actions", payload=response)