def setUp(self):
        self.view = views.DirectMessageCreateView.as_view()
        self.request_factory = RequestFactory()
        self.request = self.request_factory.get('/')
        self.user1 = self.create_superuser(email='a@b.local')
        self.request.user = self.user1
Setup the test
dataset/ETHPy150Open ofa/connect/open_connect/connectmessages/tests/test_views.py/DirectMessageCreateViewTest.setUp