Commit a22ee5a5 by Dave St.Germain

Support youtube encoded videos by using a different Profile.

parent 42d1a0c2
...@@ -19,6 +19,12 @@ PROFILE_DICT_DESKTOP = dict( ...@@ -19,6 +19,12 @@ PROFILE_DICT_DESKTOP = dict(
width=200, width=200,
height=2001 height=2001
) )
PROFILE_DICT_YOUTUBE = dict(
profile_name="youtube",
extension="mp4",
width=1280,
height=720
)
""" """
Encoded_videos for test_api, does not have profile. Encoded_videos for test_api, does not have profile.
""" """
...@@ -147,6 +153,12 @@ ENCODED_VIDEO_DICT_FISH_MOBILE = dict( ...@@ -147,6 +153,12 @@ ENCODED_VIDEO_DICT_FISH_MOBILE = dict(
bitrate=42, bitrate=42,
profile="mobile", profile="mobile",
) )
ENCODED_VIDEO_DICT_FISH_YOUTUBE = dict(
url="https://www.youtube.com/watch?v=OscRe3pSP80",
file_size=0,
bitrate=42,
profile="youtube",
)
ENCODED_VIDEO_DICT_FISH_DESKTOP = dict( ENCODED_VIDEO_DICT_FISH_DESKTOP = dict(
url="https://www.swordsplints.com", url="https://www.swordsplints.com",
file_size=1234, file_size=1234,
......
...@@ -399,6 +399,29 @@ class VideoListTest(APIAuthTestCase): ...@@ -399,6 +399,29 @@ class VideoListTest(APIAuthTestCase):
videos = len(self.client.get("/edxval/video/").data) videos = len(self.client.get("/edxval/video/").data)
self.assertEqual(videos, 1) self.assertEqual(videos, 1)
def test_post_with_youtube(self):
"""
Test that youtube is a valid profile.
"""
url = reverse('video-list')
Profile.objects.create(**constants.PROFILE_DICT_YOUTUBE)
video_data = dict(
encoded_videos=[
constants.ENCODED_VIDEO_DICT_FISH_MOBILE,
constants.ENCODED_VIDEO_DICT_FISH_YOUTUBE
],
**constants.VIDEO_DICT_FISH
)
response = self.client.post(
url, video_data, format='json'
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
videos = self.client.get("/edxval/video/").data
self.assertEqual(len(videos), 1)
self.assertIn('youtube.com', videos[0]['encoded_videos'][1]['url'])
def test_complete_set_invalid_encoded_video_post(self): def test_complete_set_invalid_encoded_video_post(self):
""" """
Tests POSTing valid Video and partial valid EncodedVideos. Tests POSTing valid Video and partial valid EncodedVideos.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment