示例#1
0
 def check_followers_count(self, sort, column):
     # Checks that we show the correct type/number of followers.
     r = self.client.get(urlparams(self.url, sort=sort))
     items = pq(r.content)('.primary .item')
     for idx, c in enumerate(r.context['pager'].object_list):
         assert items.eq(idx).find('.followers').text().split()[0] == (
             numberfmt(getattr(c, column)))
 def check_followers_count(self, sort, column):
     # Checks that we show the correct type/number of followers.
     r = self.client.get(urlparams(self.url, sort=sort))
     items = pq(r.content)('.primary .item')
     for idx, c in enumerate(r.context['pager'].object_list):
         assert items.eq(idx).find('.followers').text().split()[0] == (
             numberfmt(getattr(c, column)))
示例#3
0
 def test_users_adu_unit(self):
     doc = pq(self.client.get(urlparams(self.url, sort='users')).content)
     for item in doc('.items .item'):
         item = pq(item)
         addon_id = item('.install').attr('data-addon')
         adu = Addon.objects.get(id=addon_id).average_daily_users
         assert item('.adu').text() == (
             '%s user%s' % (numberfmt(adu), 's' if adu != 1 else ''))
示例#4
0
 def test_popular_adu_unit(self):
     doc = pq(self.client.get(urlparams(self.url, sort='popular')).content)
     for item in doc('.items .item'):
         item = pq(item)
         addon_id = item('.install').attr('data-addon')
         adu = Addon.objects.get(id=addon_id).weekly_downloads
         assert item('.adu').text() == (
             '%s weekly download%s' %
             (numberfmt(adu), 's' if adu != 1 else ''))