Пример #1
0
    def test_get_youtube_thumb(self):
        video = VideoFileFactory.create(**{'youtube_id': '14emk_jPnrI'})

        serializer = FileSerializer(video, context={'user': video.creator})

        self.assertNotEqual(serializer.get_thumbnail_url(video),
                            '/static/img/play.png')
Пример #2
0
    def test_get_audio(self):
        audio = AudioFileFactory.create()

        serializer = FileSerializer(audio, context={'user': audio.creator})
        self.assertEqual(
            serializer.get_thumbnail_url(audio),
            '/static/img/play.png'
        )
Пример #3
0
    def test_get_youtube_no_thumb(self):
        video = VideoFileFactory.create(**{'youtube_id': 'asadf'})

        serializer = FileSerializer(video, context={'user': video.creator})
        self.assertEqual(
            serializer.get_thumbnail_url(video),
            '/static/img/play.png'
        )
Пример #4
0
    def test_get_thumb_url(self):
        image = ImageFileFactory.create()

        serializer = FileSerializer(image, context={'user': image.creator})
        self.assertEqual(
            serializer.get_thumbnail_url(image),
            image.image.url + '.300x300_q85_crop.png'
        )
Пример #5
0
    def test_get_image_thumb_url(self):
        image = ImageFileFactory.create()

        serializer = FileSerializer(image, context={'user': image.creator})
        self.assertEqual(
            serializer.get_thumbnail_url(image),
            image.image.url + '.300x300_q85_crop.png'
        )
Пример #6
0
    def test_get_audio(self):
        audio = AudioFileFactory.create()

        serializer = FileSerializer(audio, context={'user': audio.creator})
        self.assertEqual(
            serializer.get_thumbnail_url(audio),
            '/static/img/play.png'
        )
Пример #7
0
    def test_get_document_thumb_url(self):
        document = DocumentFileFactory.create()

        serializer = FileSerializer(document, context={
            'user': document.creator
        })
        self.assertEqual(
            serializer.get_thumbnail_url(document),
            document.thumbnail.url + '.300x300_q85_crop.jpg'
        )