def request(): req = mock.Mock(spec=['ip']) req.ip = request_ip() return req
def request_without_ip_x_forwarded_for(): req = mock.Mock(spec=['environ']) req.environ = {'HTTP_X_FORWARDED_FOR': request_ip()} return req
def request_with_ip_cf_connecting_ip(): req = mock.Mock(spec=['environ']) req.environ = {'HTTP_CF_CONNECTING_IP': request_ip_next()} return req
def request_without_ip_remote_addr(): req = mock.Mock(spec=['environ']) req.environ = {'REMOTE_ADDR': request_ip()} return req
def request(env): req = mock.Mock() req.ip = request_ip() req.environ = env return req