コード例 #1
0
 def emailinvitation(self):
     invitation = Invitation.objects.first()
     if invitation is None:
         invited_by = random_user()
         group = Group.objects.first()
         invitation = Invitation.objects.create(group=group, invited_by=invited_by,
                                                email='*****@*****.**')
     return email_utils.prepare_emailinvitation_email(invitation)
コード例 #2
0
 def test_emailinvitation(self):
     invitation = Invitation.objects.create(
         email='*****@*****.**',
         group=self.group,
         invited_by=self.user
     )
     email = email_utils.prepare_emailinvitation_email(invitation)
     self.assertEqual(len(email.alternatives), 0)
     self.assertEqual(email.to[0], '*****@*****.**')
     self.assertIn(self.group.name, email.body)
     self.assertIn(self.user.display_name, email.body)
     self.assertIn(str(invitation.token), email.body)
     self.assertIn(settings.SITE_NAME, email.body)
     self.assertIn(settings.HOSTNAME, email.body)
     self.assertNotIn('&', email.body)
コード例 #3
0
ファイル: models.py プロジェクト: khatryshikha/karrot-backend
 def send_mail(self):
     email_utils.prepare_emailinvitation_email(self).send()