only show thanks for premium (bug 692369)

This commit is contained in:
Andy McKay 2011-10-06 10:09:36 -07:00
Родитель cc785c4d07
Коммит fdff9bafff
2 изменённых файлов: 20 добавлений и 2 удалений

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

@ -22,8 +22,10 @@
<h4>{{ _('Payment cancelled') }}</h4>
{% else %}
<h4>{{ _('Payment completed') }}</h4>
<a href="{{ url('addons.purchase.thanks', addon.slug) }}?realurl={{ realurl }}"
id="paypal-thanks">{{ _('Thank you for purchasing your add-on') }}</a>
{% if addon.is_premium() %}
<a href="{{ url('addons.purchase.thanks', addon.slug)|urlparams(realurl=realurl) }}"
id="paypal-thanks">{{ _('Thank you for purchasing the add-on') }}</a>
{% endif %}
{% endif %}
<p><a id="paypal-result" target="_top" href="{{ url('addons.detail', addon.slug) }}">{{ _('Return to the addon.') }}</a></p>
{% endblock %}

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

@ -225,6 +225,11 @@ class TestContributeEmbedded(amo.tests.TestCase):
'result_type=json'))
assert not json.loads(res.content)['paykey']
def test_result_page(self):
url = reverse('addons.paypal', args=[self.addon.slug, 'complete'])
doc = pq(self.client.get(url).content)
eq_(len(doc('#paypal-thanks')), 0)
class TestPurchaseEmbedded(amo.tests.TestCase):
fixtures = ['base/apps', 'base/addon_592', 'base/users', 'prices']
@ -357,6 +362,17 @@ class TestPurchaseEmbedded(amo.tests.TestCase):
eq_(res.status_code, 200)
eq_(pq(res.content)('a.trigger_download').attr('href'), '/foo')
@patch('paypal.check_purchase')
def test_result_page(self, check_purchase):
check_purchase.return_value = 'COMPLETED'
Contribution.objects.create(addon=self.addon, uuid='1',
user=self.user, paykey='sdf',
type=amo.CONTRIB_PENDING)
url = reverse('addons.purchase.finished',
args=[self.addon.slug, 'complete'])
doc = pq(self.client.get('%s?uuid=1' % url).content)
eq_(len(doc('#paypal-thanks')), 1)
class TestDeveloperPages(amo.tests.TestCase):
fixtures = ['base/apps', 'base/addon_3615', 'base/addon_592',