def test_reset_response(
        base_endpoint,
        core_manager,
        managed_application_client,
        server_rule_prototype,
        server_response_prototype,
    ):
    """Check that response for a rule can be changed.

    1. Create a rule, that is triggered for every endpoint.
    2. Set a response.
    3. Set another response for the same rule.
    4. Make a request.
    5. Check that new response is returned.
    """
    rule_id = core_manager.add_rule(server_rule_prototype.create_new(match_implementation=True))

    initial_implementation_triggered = False
    def _initial_builder_implementation(*args, **kwargs):
        # pylint: disable=unused-argument
        nonlocal initial_implementation_triggered
        initial_implementation_triggered = True
        return b"First response"

    first_response = server_response_prototype.create_new(
        builder_implementation=_initial_builder_implementation,
        )
    core_manager.set_response(rule_id=rule_id, response=first_response)

    second_response = server_response_prototype.create_new(
        builder_implementation=b"Second response",
        )
    core_manager.set_response(rule_id=rule_id, response=second_response)

    http_response = managed_application_client.get(base_endpoint)
    assert not initial_implementation_triggered, "Initial response was triggered"
    assert http_response.status_code == 200, "Wrong status code"
    assert http_response.data == b"Second response", "Wrong body"