documentation, admin section, plus fix of a typo on models (#293)

* documentation, admin section, plus fix of a typo on models
This commit is contained in:
Markos Gogoulos
2021-09-27 15:07:17 +03:00
committed by GitHub
parent 32e07035f3
commit 4480fa7de1
4 changed files with 65 additions and 2 deletions

View File

@@ -20,7 +20,11 @@ class TestX(TestCase):
client.login(username=self.user, password=self.password)
# use both ways, form + API to upload a new media file
# ffmpeg will transcode files synchronously
# while video transcoding through ffmpeg takes place asynchronously
# (through celery workers), inside tests ffmpeg runs synchronously
# because celery is started with setting task_always_eager
# practically this means that this testing will take some time, but
# ensures that video transcoding completes well
with open('fixtures/small_video.mp4', 'rb') as fp:
client.post('/api/v1/media', {'title': 'small video file test', 'media_file': fp})
@@ -31,9 +35,14 @@ class TestX(TestCase):
client.post('/fu/upload/', {'qqfile': fp, 'qqfilename': 'medium_video.mp4', 'qquuid': str(uuid.uuid4())})
self.assertEqual(Media.objects.all().count(), 3, "Problem with file upload")
# by default the portal_workflow is public, so anything uploaded gets public
self.assertEqual(Media.objects.filter(state='public').count(), 3, "Expected all media to be public, as per the default portal workflow")
self.assertEqual(Media.objects.filter(media_type='video', encoding_status='success').count(), 2, "Encoding did not finish well")
self.assertEqual(Media.objects.filter(media_type='video').count(), 2, "Media identification failed")
self.assertEqual(Media.objects.filter(media_type='image').count(), 1, "Media identification failed")
self.assertEqual(Media.objects.filter(user=self.user).count(), 3, "User assignment failed")
# using the provided EncodeProfiles, these two files should produce 9 Encoding objects.
# if new EncodeProfiles are added and enabled, this will break!
self.assertEqual(Encoding.objects.filter(status='success').count(), 9, "Not all video transcodings finished well")