@@ -0,0 +1,1004 @@
+%22%22%22Test the X-Forwarded-For middleware.%22%22%22%0A%0Afrom ..middleware.xforwardedfor import xforwardedfor%0A%0A%0Adef get_response_method(thing):%0A    %22%22%22Do nothing.%22%22%22%0A    return thing%0A%0A%0Adef test_setting_correctly(rf):%0A    %22%22%22Override REMOTE_ADDR if HTTP_X_FORWARDED_FOR is present.%22%22%22%0A    request = rf.get('/')%0A    request.META%5B'REMOTE_ADDR'%5D = '192.168.1.1'%0A    request.META%5B'HTTP_X_FORWARDED_FOR'%5D = '192.168.1.2'%0A%0A    xforwardedfor_middleware = xforwardedfor(get_response_method)%0A    response = xforwardedfor_middleware(request)%0A%0A    assert response is not None%0A    assert request.META%5B'REMOTE_ADDR'%5D == '192.168.1.2'%0A%0A%0Adef test_nothing_on_missing_value(rf):%0A    %22%22%22Don't override REMOTE_ADDR if HTTP_X_FORWARDED_FOR is not present.%22%22%22%0A    request = rf.get('/')%0A    request.META%5B'REMOTE_ADDR'%5D = '192.168.1.1'%0A%0A    xforwardedfor_middleware = xforwardedfor(get_response_method)%0A    response = xforwardedfor_middleware(request)%0A%0A    assert response is not None%0A    assert request.META%5B'REMOTE_ADDR'%5D == '192.168.1.1'%0A

Add tests for xforwardedfor middleware