def test_view(self):
        self.login_chairmen()
        response = self.post_invite({"email": "sample@email.com",
                                     "default_group_name": DefaultGroups.MEMBER,
                                     "message": "the message"})
        self.assertEqual(Invitation.objects.all().count(), 1)
        invitation = Invitation.objects.all()[0]
        self.assertEqual(invitation.community, self.community)
        self.assertEqual(invitation.created_by, self.chairmen[0])
        self.assertEqual(invitation.message, "the message")

        self.assertEqual(len(mail.outbox), 1)

        self.assertEqual(response.status_code, 200)
        #the response is an ajax response the show the user as added
        #to the list of members
        self.assertIn("delete-invitation", response.content)
        self.assertIn("sample@email.com", response.content)