Remove contribution info from JSON API for unapproved addons (bug 726042)
This commit is contained in:
Родитель
65711ab312
Коммит
89661cdac6
|
@ -73,6 +73,23 @@ class UtilsTest(TestCase):
|
|||
eq_(d['summary'], 'i <3 amo!')
|
||||
eq_(d['description'], 'i <3 amo!')
|
||||
|
||||
def test_contrib_info(self):
|
||||
self.a.wants_contributions = True
|
||||
self.a.suggested_amount = 5
|
||||
self.a.paypal_id = 'alice@example.com'
|
||||
self.a.save()
|
||||
d = api.utils.addon_to_dict(self.a)
|
||||
eq_(d['contribution']['suggested_amount'], 5)
|
||||
|
||||
def test_no_contrib_info_until_approved(self):
|
||||
self.a.wants_contributions = True
|
||||
self.a.suggested_amount = 5
|
||||
self.a.status = amo.STATUS_LITE
|
||||
self.a.paypal_id = 'alice@example.com'
|
||||
self.a.save()
|
||||
d = api.utils.addon_to_dict(self.a)
|
||||
assert 'contribution' not in d
|
||||
|
||||
|
||||
class No500ErrorsTest(TestCase):
|
||||
"""
|
||||
|
|
|
@ -62,7 +62,7 @@ def addon_to_dict(addon, disco=False, src='api'):
|
|||
if addon.developer_comments:
|
||||
d['dev_comments'] = addon.developer_comments
|
||||
|
||||
if addon.wants_contributions:
|
||||
if addon.takes_contributions:
|
||||
contribution = {
|
||||
'link': url(addon.contribution_url, src=src),
|
||||
'meet_developers': url(addon.meet_the_dev_url(), src=src),
|
||||
|
|
Загрузка…
Ссылка в новой задаче