def test_children_of_kind(self): p = content.ContentMetadata.objects.using( self.the_channel_id).get(title="root") expected_output = content.ContentMetadata.objects.using( self.the_channel_id).filter(title__in=["c2", "c2c2", "c2c3"]) actual_output = api.children_of_kind(channel_id=self.the_channel_id, content=p, kind="topic") self.assertEqual(set(expected_output), set(actual_output))
def children_of_kind(self, request, channelmetadata_channel_id, *args, **kwargs): """ endpoint for content api method children_of_kind(channel_id=None, content=None, kind=None, **kwargs) """ context = {'request': request, 'channel_id': channelmetadata_channel_id} data = serializers.ContentMetadataSerializer( api.children_of_kind(channel_id=channelmetadata_channel_id, content=self.kwargs['content_id'], kind=self.kwargs['kind']), context=context, many=True ).data return Response(data)
def test_children_of_kind(self): p = content.ContentMetadata.objects.using(self.the_channel_id).get(title="root") expected_output = content.ContentMetadata.objects.using(self.the_channel_id).filter(title__in=["c2", "c2c2", "c2c3"]) actual_output = api.children_of_kind(channel_id=self.the_channel_id, content=p, kind="topic") self.assertEqual(set(expected_output), set(actual_output))