Skip to content

Commit

Permalink
fix thank you email for new email field (bug 676424)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy McKay committed Aug 22, 2011
1 parent 475924f commit 009276e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions apps/amo/tests/test_views.py
Expand Up @@ -4,6 +4,7 @@
from django import http, test
from django.conf import settings
from django.core.cache import cache
from django.core import mail

import commonware.log
from lxml import etree
Expand Down Expand Up @@ -354,6 +355,21 @@ def test_subscription_event(self, urlopen):
eq_(response.status_code, 200)
eq_(SubscriptionEvent.objects.count(), 1)

@patch('amo.views.urllib2.urlopen')
def test_mail(self, urlopen):
urlopen.return_value = self.urlopener('VERIFIED')
add = Addon.objects.create(enable_thankyou=True,
support_email='a@a.com',
type=amo.ADDON_EXTENSION)
Contribution.objects.create(addon_id=add.pk,
uuid='123')
response = self.client.post(self.url, {u'action_type': u'PAY',
u'sender_email': u'a@a.com',
u'status': u'COMPLETED',
u'tracking_id': u'123'})
eq_(response.status_code, 200)
eq_(len(mail.outbox), 1)

def test_get_not_allowed(self):
response = self.client.get(self.url)
assert isinstance(response, http.HttpResponseNotAllowed)
Expand Down
3 changes: 2 additions & 1 deletion apps/amo/views.py
Expand Up @@ -273,7 +273,8 @@ def _log_error_with_data(msg, request):
# embedded payments.
for old, new in [('payment_status', 'status'),
('item_number', 'tracking_id'),
('txn_id', 'tracking_id')]:
('txn_id', 'tracking_id'),
('payer_email', 'sender_email')]:
if old not in post and new in post:
post[old] = post[new]

Expand Down

0 comments on commit 009276e

Please sign in to comment.