Permalink
Browse files

do not list disabled apps on apps homepage (bug 704704)

  • Loading branch information...
1 parent e4cdafc commit d6acf1836c111ce594e95244aafd434740ae16a0 @cvan cvan committed Nov 23, 2011
Showing with 17 additions and 3 deletions.
  1. +1 −1 apps/webapps/models.py
  2. +16 −2 apps/webapps/tests/test_views.py
View
@@ -40,7 +40,7 @@ def listed(self):
disabled_by_user=False)
def popular(self):
- return self.order_by('-weekly_downloads').with_index(
+ return self.listed().order_by('-weekly_downloads').with_index(
addons='downloads_type_idx')
def top_free(self):
@@ -48,6 +48,10 @@ def setUp(self):
amo.tests.addon_factory(type=amo.ADDON_WEBAPP),
]
+ # For measure add some disabled apps.
+ amo.tests.addon_factory(type=amo.ADDON_WEBAPP, disabled_by_user=True)
+ amo.tests.addon_factory(type=amo.ADDON_WEBAPP, status=amo.STATUS_NULL)
+
self.paid = []
for x in xrange(1, 3):
price = Price.objects.create(price=x)
@@ -57,7 +61,16 @@ def setUp(self):
addon.update(premium_type=amo.ADDON_PREMIUM)
self.paid.append(addon)
- # For measure add a free app but don't set the premium_type.
+ # For measure add some disabled apps.
+ addon = amo.tests.addon_factory(type=amo.ADDON_WEBAPP,
+ disabled_by_user=True, premium_type=amo.ADDON_PREMIUM)
+ AddonPremium.objects.create(price=price, addon=addon)
+ addon = amo.tests.addon_factory(type=amo.ADDON_WEBAPP,
+ status=amo.STATUS_NULL, premium_type=amo.ADDON_PREMIUM)
+ AddonPremium.objects.create(price=price, addon=addon)
+
+ # For measure add a free app but don't set the premium_type
+ # (i.e., an app that started but did not complete Marketplace process).
AddonPremium.objects.create(price=price,
addon=amo.tests.addon_factory(type=amo.ADDON_WEBAPP))
@@ -174,7 +187,8 @@ def test_paid_sort(self):
def test_price_sort(self):
apps = test_listing_sort(self, 'price', None, reverse=False,
sel_class='extra-opt')
- eq_(apps, list(Webapp.objects.filter(premium_type=amo.ADDON_PREMIUM)
+ eq_(apps, list(Webapp.objects.listed()
+ .filter(premium_type=amo.ADDON_PREMIUM)
.order_by('addonpremium__price__price')))
def test_rating_sort(self):

0 comments on commit d6acf18

Please sign in to comment.