def test_get_remote_ip_no_reverse_proxy(self): global_ip = '192.192.192.192' request = tornado.httpclient.HTTPRequest( url=self.test_inbound_rules_url ) setattr(request, 'remote_ip', global_ip) remote_ip = simple_stepper.get_remote_ip(request_obj=request) logging.debug(remote_ip) nose.tools.eq_( global_ip, remote_ip )
def test_get_remote_ip_from_x_forwarded_for(self): global_ip = '192.192.192.192' request = tornado.httpclient.HTTPRequest( url=self.test_inbound_rules_url, headers={ 'X-Forwarded-For': global_ip } ) remote_ip = simple_stepper.get_remote_ip(request_obj=request) logging.debug(remote_ip) nose.tools.eq_( global_ip, remote_ip )