def test_get_files_for_quality(self):
     p = content.ContentMetadata.objects.using(
         self.the_channel_id).get(title="c1")
     fm = content.Format.objects.using(
         self.the_channel_id).get(format_size=102)
     expected_output = content.File.objects.using(
         self.the_channel_id).filter(format=fm)
     actual_output = api.get_files_for_quality(
         channel_id=self.the_channel_id, content=p, format_quality="high")
     self.assertEqual(set(expected_output), set(actual_output))
Exemple #2
0
 def files_for_quality(self, request, channelmetadata_channel_id, *args, **kwargs):
     """
     endpoint for content api method
     get_files_for_quality(channel_id=None, content=None, format_quality=None, **kwargs)
     """
     context = {'request': request, 'channel_id': channelmetadata_channel_id}
     data = serializers.FileSerializer(
         api.get_files_for_quality(channel_id=channelmetadata_channel_id, content=self.kwargs['content_id'], format_quality=self.kwargs['quality']),
         context=context,
         many=True
     ).data
     return Response(data)
 def test_get_files_for_quality(self):
     p = content.ContentMetadata.objects.using(self.the_channel_id).get(title="c1")
     fm = content.Format.objects.using(self.the_channel_id).get(format_size=102)
     expected_output = content.File.objects.using(self.the_channel_id).filter(format=fm)
     actual_output = api.get_files_for_quality(channel_id=self.the_channel_id, content=p, format_quality="high")
     self.assertEqual(set(expected_output), set(actual_output))