remove figuring out url manually

This commit is contained in:
Andy McKay 2012-05-08 13:26:05 -07:00
Родитель bca0418c50
Коммит 6aa574b92b
2 изменённых файлов: 7 добавлений и 9 удалений

Просмотреть файл

@ -57,12 +57,9 @@ def mail_pending_refunds():
log.info('Sending refund emails to: %s about %s' %
(email, ', '.join([str(i) for i in addon_ids])))
addons = Addon.objects.filter(pk__in=addon_ids)
is_webapp = addons[0].is_webapp()
site_url = ('https://marketplace.mozilla.org/' if is_webapp
else settings.SITE_URL)
from_email = ('Mozilla Marketplace <nobody@mozilla.org>' if is_webapp
else settings.NOBODY_EMAIL)
ctx = {'addons': addons, 'refunds': pending, 'site_url': site_url}
ctx = {'addons': addons, 'refunds': pending,
'site_url': settings.SITE_URL}
send_mail_jinja('Pending refund requests at the Mozilla Marketplace',
'market/emails/refund-nag.txt', ctx,
from_email=from_email, recipient_list=[owner])
from_email=settings.NOBODY_EMAIL,
recipient_list=[owner])

Просмотреть файл

@ -101,10 +101,11 @@ class TestPendingRefunds(amo.tests.TestCase):
eq_(len(mail.outbox), 1)
eq_(mail.outbox[0].body.count('1 request'), 2)
@mock.patch.object(settings, 'SITE_URL', 'https://some.site.com')
def test_email_url(self):
mail_pending_refunds()
eq_(len(mail.outbox), 1)
assert 'https://marketplace.mozilla.org/' in mail.outbox[0].body
assert 'https://some.site.com/' in mail.outbox[0].body
@mock.patch.object(settings, 'SITE_URL', 'not.this.domain.com')
def test_email_escaping(self):
@ -115,5 +116,5 @@ class TestPendingRefunds(amo.tests.TestCase):
email = mail.outbox[0]
assert str(self.webapp.name) in email.body
assert '1 request' in email.body
assert not 'not.this.domain.com' in email.body
assert 'not.this.domain.com' in email.body
eq_(email.to, [self.author.email])