def METHOD_NAME(self):
    request = self.request_factory.get(
        '/somewhere',
        HTTP_X_FORWARDED_FOR='2001:da8:20f:1502:edcf:550b:4a9c:207d'
    )
    request.user = self.authenticated_user
    self.session_middleware.process_request(request)
    # No country code exists before request.
    assert 'country_code' not in request.session
    assert 'ip_address' not in request.session
    self.country_middleware.process_request(request)
    # Country code added to session.
    assert 'CN' == request.session.get('country_code')
    assert '2001:da8:20f:1502:edcf:550b:4a9c:207d' == request.session.get('ip_address')