def test_form_valid(self):
        random_number = random.randrange(0, 150000)
        text = 'Test %s' % random_number
        user2 = self.create_user()

        request = self.request_factory.post(
            '/', {'text': text, 'subject': 'cool'})
        request = patch_message_middleware(request)
        request.user = self.user1
        self.view.kwargs = {'user_uuid': user2.uuid}
        response = self.view(request, user_uuid=user2.uuid)
        self.assertEqual(response.status_code, 302)

        message = Message.objects.filter(
            thread__recipients=user2).latest('pk')
        self.assertEqual(message.text, text)
        self.assertEqual(message.sender, self.user1)
Draw a rectangle with a pen object.
dataset/ETHPy150Open ofa/connect/open_connect/connectmessages/tests/test_views.py/DirectMessageCreateViewTest.test_form_valid--crossover with--dataset/ETHPy150Open gferreira/hTools2/Lib/hTools2/modules/primitives.py/rect