def METHOD_NAME(
    self,
    endpoint: str,
    expected_location: str | None = None,
    method: str = "GET",
    **kw,
) -> Response:
    __tracebackhide__ = True
    resp = self.open(url_for(endpoint), method=method, **kw)
    assert 300 <= resp.status_code < 400, \
        f"Expected endpoint {endpoint} to redirect, got status {resp.status}"
    if expected_location is not None:
        assert resp.location == expected_location
    return resp