def test_get_missing_files(self): p = content.ContentMetadata.objects.using( self.the_channel_id).get(title="c1") expected_output = content.File.objects.using( self.the_channel_id).filter(id__in=[1, 2]) actual_output = api.get_missing_files(channel_id=self.the_channel_id, content=p) self.assertEqual(set(expected_output), set(actual_output))
def missing_files(self, request, channelmetadata_channel_id, *args, **kwargs): """ endpoint for content api method get_missing_files(channel_id=None, content=None, **kwargs) """ context = {'request': request, 'channel_id': channelmetadata_channel_id} data = serializers.FileSerializer( api.get_missing_files(channel_id=channelmetadata_channel_id, content=self.kwargs['content_id']), context=context, many=True ).data return Response(data)
def test_get_missing_files(self): p = content.ContentMetadata.objects.using(self.the_channel_id).get(title="c1") expected_output = content.File.objects.using(self.the_channel_id).filter(id__in=[1, 2]) actual_output = api.get_missing_files(channel_id=self.the_channel_id, content=p) self.assertEqual(set(expected_output), set(actual_output))