def METHOD_NAME(monkeypatch):
    """
    Test replacement performed both in the URL and data.
    """
    okay_status = 200
    class MockResponse:
        def p(self):
            pass
        def __init__(self):
            self.status_code = okay_status
            self.raise_for_status = self.p
    def mock_do_api_call(verb, uri, **kwargs):
        # Spying on mocked function is maybe too much so verify
        # the arguments here.
        assert uri == "http://localhost:8080/source/api/v1/BAR"
        assert kwargs['data'] == '"fooBARbar"'
        return MockResponse()
    for verb in ["PUT", "POST", "DELETE"]:
        call = {"uri": "http://localhost:8080/source/api/v1/%FOO%",
                "method": verb, "data": "foo%FOO%bar"}
        pattern = "%FOO%"
        value = "BAR"
        with monkeypatch.context() as m:
            m.setattr("opengrok_tools.utils.restful.do_api_call",
                      mock_do_api_call)
            assert call_rest_api(ApiCall(call), {pattern: value}). \
                status_code == okay_status