Ejemplo n.º 1
0
    def test_send_massemail_mobile( self ):
        massemail = MassEmail( subject='Test Email', body='<p>Some content...</p>', created_by=self.u, lang='pl', mobile_platform='iphone' )
        massemail.save()

        sendMassEmail( massemail )

        massemail = MassEmail.objects.get( pk=massemail.pk )

        self.assertEqual( len( mail.outbox ), 2 )
        
        self.assertEqual( massemail.sent_failed, 0 )
        self.assertEqual( massemail.sent_correctly, 2 )

        self.assertEqual( massemail.sent_failed_to, None )
        self.assertSentCorrectly( massemail.sent_correctly_to, '[email protected];[email protected]' )
Ejemplo n.º 2
0
    def test_send_massemail(self):
        massemail = MassEmail(subject='Test Email',
                              body='<p>Some content...</p>',
                              created_by=self.u,
                              lang='en')
        massemail.save()

        sendMassEmail(massemail)

        self.assertEqual(Profile.objects.count(), 7)

        massemail = MassEmail.objects.get(pk=massemail.pk)

        self.assertEqual(len(mail.outbox), 2)
        self.assertEqual(massemail.body, mail.outbox[0].body)
        self.assertEqual(massemail.subject, mail.outbox[0].subject)

        self.assertEqual(massemail.sent_failed, 0)
        self.assertEqual(massemail.sent_correctly, 2)

        self.assertEqual(massemail.sent_failed_to, None)
        self.assertSentCorrectly(massemail.sent_correctly_to,
                                 '[email protected];[email protected]')

        mail.outbox = []

        massemail.is_processed = False
        massemail.sent_correctly_to = '*****@*****.**'
        massemail.save()

        sendMassEmail(massemail)

        self.assertEqual(len(mail.outbox), 1)
        self.assertTrue('*****@*****.**' in mail.outbox[0].recipients())

        massemail = MassEmail.objects.get(pk=massemail.pk)

        self.assertEqual(massemail.sent_failed, 0)
        self.assertEqual(massemail.sent_correctly, 2)

        self.assertEqual(massemail.sent_failed_to, None)
        self.assertSentCorrectly(massemail.sent_correctly_to,
                                 '[email protected];[email protected]')
Ejemplo n.º 3
0
    def test_send_massemail_mobile(self):
        massemail = MassEmail(subject='Test Email',
                              body='<p>Some content...</p>',
                              created_by=self.u,
                              lang='pl',
                              mobile_platform='iphone')
        massemail.save()

        sendMassEmail(massemail)

        massemail = MassEmail.objects.get(pk=massemail.pk)

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

        self.assertEqual(massemail.sent_failed, 0)
        self.assertEqual(massemail.sent_correctly, 2)

        self.assertEqual(massemail.sent_failed_to, None)
        self.assertSentCorrectly(massemail.sent_correctly_to,
                                 '[email protected];[email protected]')
Ejemplo n.º 4
0
    def test_send_massemail( self ):
        massemail = MassEmail( subject='Test Email', body='<p>Some content...</p>', created_by=self.u, lang='en' )
        massemail.save()

        sendMassEmail( massemail )

        self.assertEqual( Profile.objects.count(), 7 )

        massemail = MassEmail.objects.get( pk=massemail.pk )

        self.assertEqual( len( mail.outbox ), 2 )
        self.assertEqual( massemail.body, mail.outbox[0].body )
        self.assertEqual( massemail.subject, mail.outbox[0].subject )

        self.assertEqual( massemail.sent_failed, 0 )
        self.assertEqual( massemail.sent_correctly, 2 )

        self.assertEqual( massemail.sent_failed_to, None )
        self.assertSentCorrectly( massemail.sent_correctly_to, '[email protected];[email protected]' )

        mail.outbox = []
        
        massemail.is_processed = False
        massemail.sent_correctly_to = '*****@*****.**'
        massemail.save()
        
        sendMassEmail( massemail )
        
        self.assertEqual( len( mail.outbox ), 1 )
        self.assertTrue( '*****@*****.**' in mail.outbox[0].recipients() )

        massemail = MassEmail.objects.get( pk=massemail.pk )
        
        self.assertEqual( massemail.sent_failed, 0 )
        self.assertEqual( massemail.sent_correctly, 2 )

        self.assertEqual( massemail.sent_failed_to, None )
        self.assertSentCorrectly( massemail.sent_correctly_to, '[email protected];[email protected]' )
Ejemplo n.º 5
0
    def handle(self, **options):
        for massemail in MassEmail.objects.filter(is_processed=False):
            massemail.is_processed = True
            massemail.save()

            sendMassEmail(massemail)
Ejemplo n.º 6
0
    def handle(self, **options):
        for massemail in MassEmail.objects.filter(is_processed=False):
            massemail.is_processed = True
            massemail.save()

            sendMassEmail(massemail)