def setUp(self):
        self.user1 = mommy.make('accounts.User')
        self.user2 = mommy.make('accounts.User')
        self.request_user = mommy.make('accounts.User')
        self.group1 = mommy.make('groups.Group')
        self.user1.add_to_group(self.group1.pk)
        self.user2.add_to_group(self.group1.pk)
        self.view = views.GroupMemberInviteView()
        self.view.kwargs = {'pk': self.group1.pk}
        request_factory = RequestFactory()
        self.view.request = request_factory.get('/')
        self.view.request.user = self.request_user

        self.email_list = [
            self.user1.email,
            self.user2.email,
            'test3@example.com',
            'Test User 4 <test4@example.com>'
        ]
        self.emails = ', '.join(self.email_list)

        djmessages_patcher = patch('open_connect.groups.views.messages')
        self.mockdjmessage = djmessages_patcher.start()
        self.addCleanup(djmessages_patcher.stop)
Setup GroupInviteView tests
dataset/ETHPy150Open ofa/connect/open_connect/groups/tests/test_views.py/TestGroupInviteView.setUp