def test_deserialize_many(self): data = serializers.FeedAppESSerializer( [self.data_es, self.data_es], context={ 'app_map': self.app_map, 'request': amo.tests.req_factory_factory('')}, many=True).data eq_(data[0]['app']['id'], self.feedapp.app_id) eq_(data[1]['description']['en-US'], 'test')
def test_background_image(self): self.feedapp.update(type=feed.FEEDAPP_IMAGE, image_hash='LOL') self.data_es = self.feedapp.get_indexer().extract_document( None, obj=self.feedapp) self.app_map = { self.feedapp.app_id: WebappIndexer.extract_document(self.feedapp.app_id) } data = serializers.FeedAppESSerializer(self.data_es, context=self.context).data assert data['background_image'].endswith('image.png?LOL')
def test_deserialize(self): data = serializers.FeedAppESSerializer(self.data_es, context=self.context).data eq_(data['app']['id'], self.feedapp.app_id) eq_(data['description']['en-US'], 'test') eq_( data['preview'], { 'id': self.feedapp.preview.id, 'thumbnail_size': [50, 50], 'thumbnail_url': self.feedapp.preview.thumbnail_url })
def test_deserialize(self): data = serializers.FeedAppESSerializer(self.data_es, context={ 'app_map': self.app_map, 'request': amo.tests.req_factory_factory('') }).data eq_(data['app']['id'], self.feedapp.app_id) eq_(data['description']['en-US'], 'test') eq_(data['preview'], { 'id': self.feedapp.preview.id, 'thumbnail_size': [50, 50], 'thumbnail_url': self.feedapp.preview.thumbnail_url})
def test_deserialize_many(self): data = serializers.FeedAppESSerializer([self.data_es, self.data_es], context=self.context, many=True).data eq_(data[0]['app']['id'], self.feedapp.app_id) eq_(data[1]['description']['en-US'], 'test')