def test_remote_clients(http_app): client = RasaCoreClient(EndpointConfig(http_app)) cid = str(uuid.uuid1()) client.respond("/greet", cid) clients = client.clients() assert cid in clients
def test_predict(http_app, app): client = RasaCoreClient(EndpointConfig(http_app)) cid = str(uuid.uuid1()) for event in test_events[:2]: client.append_event_to_tracker(cid, event) out = app.get('/domain', headers={'Accept': 'yml'}) domain = TemplateDomain.from_yaml(out.get_data()) tracker = client.tracker(cid, domain) event_dicts = [ev.as_dict() for ev in tracker.applied_events()] response = app.post('/predict', json=event_dicts) assert response.status_code == 200
def test_remote_append_events(http_app): client = RasaCoreClient(EndpointConfig(http_app)) cid = str(uuid.uuid1()) client.append_events_to_tracker(cid, test_events[:2]) tracker = client.tracker_json(cid) evts = tracker.get("events") expected = [ActionExecuted(ACTION_LISTEN_NAME)] + test_events[:2] assert events.deserialise_events(evts) == expected
def test_predict(http_app, app): client = RasaCoreClient(EndpointConfig(http_app)) cid = str(uuid.uuid1()) for event in test_events[:2]: client.append_event_to_tracker(cid, event) out = app.get('/domain', headers={'Accept': 'yml'}) domain = Domain.from_yaml(out.get_data()) tracker = client.tracker(cid, domain) event_dicts = [ev.as_dict() for ev in tracker.applied_events()] response = app.post('/predict', json=event_dicts) assert response.status_code == 200
def test_remote_append_events(http_app, event): client = RasaCoreClient(EndpointConfig(http_app)) cid = str(uuid.uuid1()) client.append_event_to_tracker(cid, event) tracker = client.tracker_json(cid) evts = tracker.get("events") expected = [ActionExecuted(ACTION_LISTEN_NAME), event] assert events.deserialise_events(evts) == expected
def test_sorted_predict(http_app, app): client = RasaCoreClient(EndpointConfig(http_app)) cid = str(uuid.uuid1()) for event in test_events[:3]: client.append_event_to_tracker(cid, event) response = app.post("http://dummy/conversations/{}/predict".format(cid)) content = response.get_json() scores = content["scores"] sorted_scores = sorted(scores, key = lambda k: (-k['score'], k['action'])) assert scores == sorted_scores
def test_remote_status(http_app): client = RasaCoreClient(EndpointConfig(http_app)) status = client.status() assert status.get("version") == rasa_core.__version__
def test_remote_status(http_app): client = RasaCoreClient(http_app, None) status = client.status() assert status.get("version") == rasa_core.__version__
def test_remote_status(http_app): client = RasaCoreClient(EndpointConfig(http_app)) status = client.status() assert status.get("version") == rasa_core.__version__