示例#1
0
 def test_two_owners(self):
     user = UserProfile.objects.exclude(pk=self.author.pk)[0]
     AddonUser.objects.create(user=user, addon=self.webapp)
     mail_pending_refunds()
     eq_(len(mail.outbox), 2)
     emails = set([m.to[0] for m in mail.outbox])
     eq_(set([self.author.email, user.email]), emails)
示例#2
0
文件: test_cron.py 项目: vdt/zamboni
 def test_two_owners(self):
     user = UserProfile.objects.exclude(pk=self.author.pk)[0]
     AddonUser.objects.create(user=user, addon=self.webapp)
     mail_pending_refunds()
     eq_(len(mail.outbox), 2)
     emails = set([m.to[0] for m in mail.outbox])
     eq_(set([self.author.email, user.email]), emails)
示例#3
0
 def test_one_owner_one_other(self):
     user = UserProfile.objects.exclude(pk=self.author.pk)[0]
     AddonUser.objects.create(user=user, addon=self.webapp,
                              role=amo.AUTHOR_ROLE_VIEWER)
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert mail.outbox[0].to == [self.author.email]
示例#4
0
文件: test_cron.py 项目: vdt/zamboni
 def test_not_pending(self):
     for status in [
             amo.REFUND_APPROVED, amo.REFUND_APPROVED_INSTANT,
             amo.REFUND_DECLINED
     ]:
         self.refund.update(status=status)
         mail_pending_refunds()
     eq_(len(mail.outbox), 0)
示例#5
0
文件: test_cron.py 项目: vdt/zamboni
 def test_one_owner_one_other(self):
     user = UserProfile.objects.exclude(pk=self.author.pk)[0]
     AddonUser.objects.create(user=user,
                              addon=self.webapp,
                              role=amo.AUTHOR_ROLE_VIEWER)
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert mail.outbox[0].to == [self.author.email]
示例#6
0
 def test_two_addons(self):
     other = Addon.objects.create(app_slug='something-else',
                                  name='cthulhu', type=amo.ADDON_WEBAPP)
     AddonUser.objects.create(user=self.author, addon=other,
                              role=amo.AUTHOR_ROLE_OWNER)
     self.create_refund(other)
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     eq_(mail.outbox[0].body.count('1 request'), 2)
示例#7
0
文件: test_cron.py 项目: vdt/zamboni
 def test_email_escaping(self):
     self.webapp.name = 'You <3 My App'
     self.webapp.save()
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     email = mail.outbox[0]
     assert str(self.webapp.name) in email.body
     assert '1 request' in email.body
     assert 'not.this.domain.com' in email.body
     eq_(email.to, [self.author.email])
示例#8
0
 def test_email_escaping(self):
     self.webapp.name = 'You <3 My App'
     self.webapp.save()
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     email = mail.outbox[0]
     assert str(self.webapp.name) in email.body
     assert '1 request' in email.body
     assert 'not.this.domain.com' in email.body
     eq_(email.to, [self.author.email])
示例#9
0
文件: test_cron.py 项目: vdt/zamboni
 def test_two_addons(self):
     other = Addon.objects.create(app_slug='something-else',
                                  name='cthulhu',
                                  type=amo.ADDON_WEBAPP)
     AddonUser.objects.create(user=self.author,
                              addon=other,
                              role=amo.AUTHOR_ROLE_OWNER)
     self.create_refund(other)
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     eq_(mail.outbox[0].body.count('1 request'), 2)
示例#10
0
 def test_email_url(self):
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert 'https://marketplace.mozilla.org/' in mail.outbox[0].body
示例#11
0
 def test_not_pending(self):
     for status in [amo.REFUND_APPROVED, amo.REFUND_APPROVED_INSTANT,
                    amo.REFUND_DECLINED]:
         self.refund.update(status=status)
         mail_pending_refunds()
     eq_(len(mail.outbox), 0)
示例#12
0
 def test_none(self):
     self.refund.delete()
     mail_pending_refunds()
     eq_(len(mail.outbox), 0)
示例#13
0
文件: test_cron.py 项目: vdt/zamboni
 def test_single(self):
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert str(self.webapp.name) in mail.outbox[0].body
     assert '1 request' in mail.outbox[0].body
     assert mail.outbox[0].to == [self.author.email]
示例#14
0
文件: test_cron.py 项目: vdt/zamboni
 def test_plural(self):
     self.create_refund()
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert '2 requests' in mail.outbox[0].body
示例#15
0
 def test_single(self):
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert str(self.webapp.name) in mail.outbox[0].body
     assert '1 request' in mail.outbox[0].body
     assert mail.outbox[0].to == [self.author.email]
示例#16
0
文件: test_cron.py 项目: vdt/zamboni
 def test_none(self):
     self.refund.delete()
     mail_pending_refunds()
     eq_(len(mail.outbox), 0)
示例#17
0
 def test_plural(self):
     self.create_refund()
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert '2 requests' in mail.outbox[0].body
示例#18
0
文件: test_cron.py 项目: vdt/zamboni
 def test_email_url(self):
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert 'https://some.site.com/' in mail.outbox[0].body
示例#19
0
 def test_email_url(self):
     mail_pending_refunds()
     eq_(len(mail.outbox), 1)
     assert 'https://some.site.com/' in mail.outbox[0].body