def _request(self, request): self.monitor.count('requests', 1) if net.is_local_address(request.remote_ip): self.monitor.count('localhost_requests', 1) if net.is_private_address(request.remote_ip): self.monitor.count('private_requests', 1) return NullTransform()
def test_is_private_address_works_with_python3(self, is_python2_mock): """Test is_private_address method works for python3.""" is_python2_mock.return_value = False self.assertTrue(is_private_address(u'127.0.0.1')) self.assertTrue(is_private_address('127.0.0.1')) self.assertFalse(is_private_address('126.0.0.10'))