def test_mongo_additional_events(default_domain: Domain):
    tracker_store = MockedMongoTrackerStore(default_domain)
    events, tracker = create_tracker_with_partially_saved_events(tracker_store)

    # make sure only new events are returned
    # noinspection PyProtectedMember
    assert list(tracker_store._additional_events(tracker)) == events
Example #2
0
def test_sql_additional_events(default_domain: Domain):
    tracker_store = SQLTrackerStore(default_domain)
    additional_events, tracker = create_tracker_with_partially_saved_events(
        tracker_store)

    # make sure only new events are returned
    with tracker_store.session_scope() as session:
        # noinspection PyProtectedMember
        assert (list(tracker_store._additional_events(
            session, tracker)) == additional_events)
def test_mongo_additional_events_with_session_start(default_domain: Domain):
    sender = "test_mongo_additional_events_with_session_start"
    tracker_store = MockedMongoTrackerStore(default_domain)
    tracker = _saved_tracker_with_multiple_session_starts(tracker_store, sender)

    tracker.update(UserUttered("hi2"))

    # noinspection PyProtectedMember
    additional_events = list(tracker_store._additional_events(tracker))

    assert len(additional_events) == 1
    assert isinstance(additional_events[0], UserUttered)
Example #4
0
def test_mongo_additional_events(
        domain: Domain, retrieve_events_from_previous_conversation_sessions):
    tracker_store = MockedMongoTrackerStore(
        domain,
        retrieve_events_from_previous_conversation_sessions=
        retrieve_events_from_previous_conversation_sessions,
    )
    events, tracker = create_tracker_with_partially_saved_events(tracker_store)

    # make sure only new events are returned
    # noinspection PyProtectedMember
    assert list(tracker_store._additional_events(tracker)) == events
def test_sql_additional_events_with_session_start(default_domain: Domain):
    sender = "test_sql_additional_events_with_session_start"
    tracker_store = SQLTrackerStore(default_domain)
    tracker = _saved_tracker_with_multiple_session_starts(tracker_store, sender)

    tracker.update(UserUttered("hi2"), default_domain)

    # make sure only new events are returned
    with tracker_store.session_scope() as session:
        # noinspection PyProtectedMember
        additional_events = list(tracker_store._additional_events(session, tracker))
        assert len(additional_events) == 1
        assert isinstance(additional_events[0], UserUttered)
Example #6
0
def test_sql_additional_events(
        domain: Domain, retrieve_events_from_previous_conversation_sessions):
    tracker_store = SQLTrackerStore(
        domain,
        retrieve_events_from_previous_conversation_sessions=
        retrieve_events_from_previous_conversation_sessions,
    )
    additional_events, tracker = create_tracker_with_partially_saved_events(
        tracker_store)

    # make sure only new events are returned
    with tracker_store.session_scope() as session:
        # noinspection PyProtectedMember
        assert (list(tracker_store._additional_events(
            session, tracker)) == additional_events)