def test_get_ip(self):
        request_factory = RequestFactory()
        request = request_factory.get(ADMIN_LOGIN_URL)
        request.user = AnonymousUser()
        request.session = SessionStore()

        self.assertEqual(utils.get_ip(request), '127.0.0.1')
Tests if can handle a long user agent
dataset/ETHPy150Open kencochrane/django-defender/defender/tests.py/AccessAttemptTest.test_get_ip