def test_region_handles_worldwide(self): data = { 'region': 'worldwide', 'item_type': 'app', 'app': self.feedapps[0].id, } serializer = serializers.FeedItemSerializer(data=data) assert serializer.is_valid() assert serializer.validated_data['region'] == RESTOFWORLD.id
def serializer(self, data=None, item=None): if not item: return serializers.FeedItemSerializer(data=data, context=self.context) return serializers.FeedItemSerializer(instance=item, context=self.context)
def serializer(self, item=None, **context): if not item: return serializers.FeedItemSerializer(context=context) return serializers.FeedItemSerializer(item, context=context)