def test_basic(self): super(TestCollectionWithAddonsSerializer, self).test_basic() collection_addon = CollectionAddon.objects.get( addon=self.addon, collection=self.collection ) data = self.serialize() assert data['addons'] == [CollectionAddonSerializer(collection_addon).data] assert data['addons'][0]['addon']['id'] == self.addon.id
def serialize(self): return CollectionAddonSerializer(self.item).data