Пример #1
0
 def test_preview(self):
     self.addon.update(premium_type=mkt.ADDON_PREMIUM)
     res = self.post(recipients='payments', preview_only=True)
     self.assertNoFormErrors(res)
     preview = EmailPreviewTopic(topic='email-devs')
     eq_([e.recipient_list for e in preview.filter()],
         ['*****@*****.**'])
     eq_(len(mail.outbox), 0)
Пример #2
0
 def test_preview(self):
     self.addon.update(premium_type=mkt.ADDON_PREMIUM)
     res = self.post(recipients='payments', preview_only=True)
     self.assertNoFormErrors(res)
     preview = EmailPreviewTopic(topic='email-devs')
     eq_([e.recipient_list for e in preview.filter()],
         ['*****@*****.**'])
     eq_(len(mail.outbox), 0)
Пример #3
0
class TestEmailPreview(mkt.site.tests.TestCase):
    fixtures = fixture('user_admin', 'group_admin', 'user_admin_group',
                       'webapp_337141')

    def setUp(self):
        self.login('*****@*****.**')
        addon = Webapp.objects.get(pk=337141)
        self.topic = EmailPreviewTopic(addon)

    def test_csv(self):
        self.topic.send_mail('the subject', u'Hello Ivan Krsti\u0107',
                             from_email='*****@*****.**',
                             recipient_list=['*****@*****.**'])
        r = self.client.get(reverse('zadmin.email_preview_csv',
                                    args=[self.topic.topic]))
        eq_(r.status_code, 200)
        rdr = csv.reader(StringIO(r.content))
        eq_(rdr.next(), ['from_email', 'recipient_list', 'subject', 'body'])
        eq_(rdr.next(), ['*****@*****.**', '*****@*****.**',
                         'the subject', 'Hello Ivan Krsti\xc4\x87'])
Пример #4
0
class TestEmailPreview(mkt.site.tests.TestCase):
    fixtures = fixture('user_admin', 'group_admin', 'user_admin_group',
                       'webapp_337141')

    def setUp(self):
        self.login('*****@*****.**')
        addon = Webapp.objects.get(pk=337141)
        self.topic = EmailPreviewTopic(addon)

    def test_csv(self):
        self.topic.send_mail('the subject',
                             u'Hello Ivan Krsti\u0107',
                             from_email='*****@*****.**',
                             recipient_list=['*****@*****.**'])
        r = self.client.get(
            reverse('zadmin.email_preview_csv', args=[self.topic.topic]))
        eq_(r.status_code, 200)
        rdr = csv.reader(StringIO(r.content))
        eq_(rdr.next(), ['from_email', 'recipient_list', 'subject', 'body'])
        eq_(rdr.next(), [
            '*****@*****.**', '*****@*****.**', 'the subject',
            'Hello Ivan Krsti\xc4\x87'
        ])
Пример #5
0
def admin_email(all_recipients,
                subject,
                body,
                preview_only=False,
                from_email=settings.DEFAULT_FROM_EMAIL,
                preview_topic='admin_email',
                **kw):
    log.info('[%s@%s] admin_email about %r' %
             (len(all_recipients), admin_email.rate_limit, subject))
    if preview_only:
        send = EmailPreviewTopic(topic=preview_topic).send_mail
    else:
        send = send_mail
    for recipient in all_recipients:
        send(subject, body, recipient_list=[recipient], from_email=from_email)
Пример #6
0
 def setUp(self):
     self.login('*****@*****.**')
     addon = Webapp.objects.get(pk=337141)
     self.topic = EmailPreviewTopic(addon)
Пример #7
0
 def setUp(self):
     self.login('*****@*****.**')
     addon = Webapp.objects.get(pk=337141)
     self.topic = EmailPreviewTopic(addon)