Пример #1
0
    def test_create_image(self):
        """
        An image is created from an uploaded file.

        Verifies all appropriate fields are correctly set.
        """
        with open('apps/upload/tests/media/test.jpg') as f:
            up_file = File(f)
            file_info = create_image({'image': up_file}, self.user)

        image = Image.objects.all()[0]
        delete_url = reverse('gallery.delete_media',
                             args=['image', image.id])
        check_file_info(
            file_info, name='apps/upload/tests/media/test.jpg',
            width=90, height=120, delete_url=delete_url,
            url=image.get_absolute_url(), thumbnail_url=image.file.url)
Пример #2
0
    def test_create_video(self):
        """
        A video is created from an uploaded file.

        Verifies all appropriate fields are correctly set.
        """
        with open('apps/gallery/tests/media/test.flv') as f:
            up_file = File(f)
            file_info = create_video({'flv': up_file}, self.user)

        vid = Video.objects.all()[0]
        delete_url = reverse('gallery.delete_media',
                             args=['video', vid.id])
        check_file_info(
            file_info, name='apps/gallery/tests/media/test.flv',
            width=32, height=32, delete_url=delete_url,
            url=vid.get_absolute_url(),
            thumbnail_url=settings.GALLERY_VIDEO_THUMBNAIL_PROGRESS_URL)
Пример #3
0
    def test_create_image(self):
        """
        An image is created from an uploaded file.

        Verifies all appropriate fields are correctly set.
        """
        with open('apps/upload/tests/media/test.jpg') as f:
            up_file = File(f)
            file_info = create_image({'image': up_file}, self.user)

        image = Image.objects.all()[0]
        delete_url = reverse('gallery.delete_media', args=['image', image.id])
        check_file_info(file_info,
                        name='apps/upload/tests/media/test.jpg',
                        width=90,
                        height=120,
                        delete_url=delete_url,
                        url=image.get_absolute_url(),
                        thumbnail_url=image.file.url)
Пример #4
0
    def test_create_video(self):
        """
        A video is created from an uploaded file.

        Verifies all appropriate fields are correctly set.
        """
        with open('apps/gallery/tests/media/test.flv') as f:
            up_file = File(f)
            file_info = create_video({'flv': up_file}, self.user)

        vid = Video.objects.all()[0]
        delete_url = reverse('gallery.delete_media', args=['video', vid.id])
        check_file_info(
            file_info,
            name='apps/gallery/tests/media/test.flv',
            width=32,
            height=32,
            delete_url=delete_url,
            url=vid.get_absolute_url(),
            thumbnail_url=settings.GALLERY_VIDEO_THUMBNAIL_PROGRESS_URL)