Beispiel #1
0
    def setUp(self):
        """Setup GroupInviteView tests"""
        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, '*****@*****.**',
            'Test User 4 <*****@*****.**>'
        ]
        self.emails = ', '.join(self.email_list)

        djmessages_patcher = patch('open_connect.groups.views.messages')
        self.mockdjmessage = djmessages_patcher.start()
        self.addCleanup(djmessages_patcher.stop)
Beispiel #2
0
 def test_non_existent_group_throws_404(self):
     """Test requesting a group that does not exist throws a 404"""
     view = views.GroupMemberInviteView()
     view.kwargs = {'pk': 500000}
     with self.assertRaises(Http404):
         view.get_context_data()