def test_form_valid_x_forwarded_for_missing(self):
        self.client.post(
            reverse('create_message'),
            {
                'subject': 'fjdsklfs',
                'text': 'jdfklsj',
                'group': self.group1.pk
            },
            HTTP_USER_AGENT='Chromefox',
            REMOTE_ADDR='1.2.3.4'
        )
        message = Message.objects.latest('pk')
        self.assertEqual(message.ip_address, '1.2.3.4')
Sender, user_agent, and ip_address should be set on form_valid.
dataset/ETHPy150Open ofa/connect/open_connect/connectmessages/tests/test_views.py/MessageCreateViewTest.test_form_valid_x_forwarded_for_missing