Beispiel #1
0
    def test_log_ip_xforwarded(self):
        request = APIRequestFactory().get('/logging')
        request.META['HTTP_X_FORWARDED_FOR'] = '127.0.0.8'

        MockLoggingView.as_view()(request).render()
        log = APIRequestLog.objects.first()
        self.assertEqual(log.remote_addr, '127.0.0.8')
Beispiel #2
0
    def test_log_ip_xforwarded(self):
        request = APIRequestFactory().get('/logging')
        request.META['HTTP_X_FORWARDED_FOR'] = '127.0.0.8'

        MockLoggingView.as_view()(request).render()
        log = APIRequestLog.objects.first()
        self.assertEqual(log.remote_addr, '127.0.0.8')
Beispiel #3
0
    def test_log_ip_remote(self):
        request = APIRequestFactory().get('/logging')
        request.META['REMOTE_ADDR'] = '127.0.0.9'

        MockLoggingView.as_view()(request).render()
        log = APIRequestLog.objects.first()
        self.assertEqual(log.remote_addr, '127.0.0.9')
Beispiel #4
0
    def test_log_ip_remote(self):
        request = APIRequestFactory().get('/logging')
        request.META['REMOTE_ADDR'] = '127.0.0.9'

        MockLoggingView.as_view()(request).render()
        log = APIRequestLog.objects.first()
        self.assertEqual(log.remote_addr, '127.0.0.9')