Exemple #1
0
    def test_basic_serialization(self):
        loves = Love.objects.all()[:10]
        activities = [l.create_activity() for l in loves]
        aggregator = NotificationAggregator()
        aggregated_activities = aggregator.aggregate(activities)
        serializer = AggregatedActivitySerializer()

        for aggregated in aggregated_activities:
            serialized = serializer.dumps(aggregated)
            unserialized = serializer.loads(serialized)
            self.assertAggregatedEqual(aggregated, unserialized)
Exemple #2
0
    def test_basic_serialization(self):
        loves = Love.objects.all()[:10]
        activities = [l.create_activity() for l in loves]
        aggregator = NotificationAggregator()
        aggregated_activities = aggregator.aggregate(activities)
        serializer = AggregatedActivitySerializer()

        for aggregated in aggregated_activities:
            serialized = serializer.dumps(aggregated)
            unserialized = serializer.loads(serialized)
            self.assertAggregatedEqual(aggregated, unserialized)
Exemple #3
0
 def __init__(self, model, *args, **kwargs):
     AggregatedActivitySerializer.__init__(self, *args, **kwargs)
     self.model = model
Exemple #4
0
 def get_serializer(self):
     serializer = AggregatedActivitySerializer(Notification)
     return serializer
 def __init__(self, model, *args, **kwargs):
     AggregatedActivitySerializer.__init__(self, *args, **kwargs)
     self.model = model