def test_home_serializer_listing_coll(self): """Test the listing collection is using ESAppFeedSerializer.""" self.collection.update(type=feed.COLLECTION_LISTING) self.data_es = self.collection.get_indexer().extract_document( None, obj=self.collection) data = serializers.FeedCollectionESHomeSerializer( self.data_es, context=self.context).data ok_('author' in data['apps'][0]) ok_(data['apps'][0]['name']) ok_(data['apps'][0]['ratings']) ok_(data['apps'][0]['icons']) eq_(data['app_count'], len(self.app_map))
def test_home_serializer_promo_coll(self): """ Test the listing collection is using ESAppFeedCollectionSerializer if no background image. """ self.collection.update(type=feed.COLLECTION_PROMO) self.data_es = self.collection.get_indexer().extract_document( None, obj=self.collection) data = serializers.FeedCollectionESHomeSerializer( self.data_es, context=self.context).data assert 'author' not in data['apps'][0] assert 'name' not in data['apps'][0] assert 'ratings' not in data['apps'][0] assert data['apps'][0]['icons']