def test_create_image(self): """ An image is created from an uploaded file. Verifies all appropriate fields are correctly set. """ with open('kitsune/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='test.png', width=90, height=120, delete_url=delete_url, url=image.get_absolute_url(), thumbnail_url=image.file.url)
def test_create_video(self): """ A video is created from an uploaded file. Verifies all appropriate fields are correctly set. """ with open('kitsune/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='kitsune/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)
def test_create_image(self): """ An image is created from an uploaded file. Verifies all appropriate fields are correctly set. """ with open('kitsune/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='test.png', width=90, height=120, delete_url=delete_url, url=image.get_absolute_url(), thumbnail_url=image.file.url)