87826c4ccb971911752adbc4bdac8d3e7c28989e,tests/test_actions.py,,test_remote_action_runs,#Any#Any#Any#,83

Before Change


    remote_action = action.RemoteAction("my_action",
                                        endpoint)

    httpretty.register_uri(
        httpretty.POST,
        "https://abc.defg/webhooks/actions",
        body="{"events": [], "responses": []}")

    httpretty.enable()
    loop.run_until_complete(remote_action.run(default_dispatcher_collecting,
                                              tracker,
                                              default_domain))
    httpretty.disable()

    assert (httpretty.latest_requests[-1].path ==
            "/webhooks/actions")

    b = httpretty.latest_requests[-1].body.decode("utf-8")

    assert json.loads(b) == {
        "domain": default_domain.as_dict(),
        "next_action": "my_action",

After Change


    remote_action = action.RemoteAction("my_action",
                                        endpoint)

    with aioresponses() as mocked:
        mocked.post(
            "https://example.com/webhooks/actions",
            payload={"events": [], "responses": []})

        loop.run_until_complete(remote_action.run(default_dispatcher_collecting,
                                                  tracker,
                                                  default_domain))

        r = latest_request(mocked, "post",
                           "https://example.com/webhooks/actions")

        assert r

        assert json_of_latest_request(r) == {
            "domain": default_domain.as_dict(),
            "next_action": "my_action",
            "sender_id": "default",
            "version": rasa_core.__version__,
            "tracker": {
                "latest_message": {
                    "entities": [],
                    "intent": {},
                    "text": None
                },
                "active_form": {},
                "latest_action_name": None,
                "sender_id": "default",
                "paused": False,
                "latest_event_time": None,
                "followup_action": "action_listen",
                "slots": {"name": None},
                "events": [],
                "latest_input_channel": None
            }
        }


def test_remote_action_logs_events(loop,
                                   default_dispatcher_collecting,
                                   default_domain):
    tracker = DialogueStateTracker("default",
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 14

Instances


Project Name: RasaHQ/rasa
Commit Name: 87826c4ccb971911752adbc4bdac8d3e7c28989e
Time: 2019-01-21
Author: tom@rasa.com
File Name: tests/test_actions.py
Class Name:
Method Name: test_remote_action_runs


Project Name: RasaHQ/rasa
Commit Name: 87826c4ccb971911752adbc4bdac8d3e7c28989e
Time: 2019-01-21
Author: tom@rasa.com
File Name: tests/test_actions.py
Class Name:
Method Name: test_remote_action_runs


Project Name: RasaHQ/rasa
Commit Name: 87826c4ccb971911752adbc4bdac8d3e7c28989e
Time: 2019-01-21
Author: tom@rasa.com
File Name: tests/test_actions.py
Class Name:
Method Name: test_remote_action_logs_events


Project Name: RasaHQ/rasa
Commit Name: 87826c4ccb971911752adbc4bdac8d3e7c28989e
Time: 2019-01-21
Author: tom@rasa.com
File Name: tests/test_interactive.py
Class Name:
Method Name: test_request_prediction