87826c4ccb971911752adbc4bdac8d3e7c28989e,tests/test_channels.py,,test_callback_calls_endpoint,#Any#,392

Before Change


    httpretty.register_uri(httpretty.POST,
                           "https://mycallback.com/callback")

    httpretty.enable()

    output = CallbackOutput(EndpointConfig("https://mycallback.com/callback"))

    loop.run_until_complete(

After Change



def test_callback_calls_endpoint(loop):
    from rasa_core.channels.callback import CallbackOutput
    with aioresponses() as mocked:
        mocked.post("https://example.com/callback",
                    repeat=True,
                    headers={"Content-Type": "application/json"})

        output = CallbackOutput(EndpointConfig("https://example.com/callback"))

        loop.run_until_complete(
            output.send_response("test-id", {
                "text": "Hi there!",
                "image": "https://example.com/image.jpg"}))

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

        assert r

        image = r[-1].kwargs["json"]
        text = r[-2].kwargs["json"]

        assert image["recipient_id"] == "test-id"
        assert image["image"] == "https://example.com/image.jpg"

        assert text["recipient_id"] == "test-id"
        assert text["text"] == "Hi there!"


def test_slack_message_sanitization():
    from rasa_core.channels.slack import SlackInput
    test_uid = 17213535
    target_message_1 = "You can sit here if you want"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


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


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


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


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_send_message