From 6aa574b92b312850caac75e6c8306f0527553d73 Mon Sep 17 00:00:00 2001 From: Andy McKay Date: Tue, 8 May 2012 13:26:05 -0700 Subject: [PATCH] remove figuring out url manually --- apps/market/cron.py | 11 ++++------- apps/market/tests/test_cron.py | 5 +++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/market/cron.py b/apps/market/cron.py index 82f2f30758..41bb9c4923 100644 --- a/apps/market/cron.py +++ b/apps/market/cron.py @@ -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 ' 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]) diff --git a/apps/market/tests/test_cron.py b/apps/market/tests/test_cron.py index ca29e72713..1f8e3c22e6 100644 --- a/apps/market/tests/test_cron.py +++ b/apps/market/tests/test_cron.py @@ -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])