Ejemplo n.º 1
0
 def test_create_youtube_string_missing(self):
     """
     Test that Youtube IDs which aren't explicitly set aren't included in the output string.
     """
     self.descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     self.descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     self.descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA"
     self.assertEqual(create_youtube_string(self.descriptor), expected)
Ejemplo n.º 2
0
 def test_create_youtube_string_missing(self):
     """
     Test that Youtube IDs which aren't explicitly set aren't included in the output string.
     """
     self.descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     self.descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     self.descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA"
     self.assertEqual(create_youtube_string(self.descriptor), expected)
Ejemplo n.º 3
0
 def test_create_youtube_string(self):
     """
     Test that Youtube ID strings are correctly created when writing back out to XML.
     """
     self.descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     self.descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     self.descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     self.descriptor.youtube_id_1_5 = 'rABDYkeK0x8'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8"
     self.assertEqual(create_youtube_string(self.descriptor), expected)
Ejemplo n.º 4
0
 def test_create_youtube_string(self):
     """
     Test that Youtube ID strings are correctly created when writing back out to XML.
     """
     self.descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     self.descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     self.descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     self.descriptor.youtube_id_1_5 = 'rABDYkeK0x8'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8"
     self.assertEqual(create_youtube_string(self.descriptor), expected)
Ejemplo n.º 5
0
 def test_create_youtube_string_missing(self):
     """
     Test that Youtube IDs which aren't explicitly set aren't included
     in the output string.
     """
     system = DummySystem(load_error_modules=True)
     location = Location("edX", 'course', 'run', "video", "SampleProblem1", None)
     field_data = DictFieldData({'location': location})
     descriptor = VideoDescriptor(system, field_data, Mock())
     descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA"
     self.assertEqual(create_youtube_string(descriptor), expected)
Ejemplo n.º 6
0
 def test_create_youtube_string_missing(self):
     """
     Test that Youtube IDs which aren't explicitly set aren't included
     in the output string.
     """
     system = DummySystem(load_error_modules=True)
     location = Location(["i4x", "edX", "video", "default", "SampleProblem1"])
     field_data = DictFieldData({'location': location})
     descriptor = VideoDescriptor(system, field_data, Mock())
     descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA"
     self.assertEqual(create_youtube_string(descriptor), expected)
Ejemplo n.º 7
0
 def test_create_youtube_string(self):
     """
     Test that Youtube ID strings are correctly created when writing
     back out to XML.
     """
     system = DummySystem(load_error_modules=True)
     location = Location("edX", 'course', 'run', "video", 'SampleProblem1', None)
     field_data = DictFieldData({'location': location})
     descriptor = VideoDescriptor(system, field_data, Mock())
     descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     descriptor.youtube_id_1_5 = 'rABDYkeK0x8'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8"
     self.assertEqual(create_youtube_string(descriptor), expected)
Ejemplo n.º 8
0
 def test_create_youtube_string(self):
     """
     Test that Youtube ID strings are correctly created when writing
     back out to XML.
     """
     system = DummySystem(load_error_modules=True)
     location = Location(["i4x", "edX", "video", "default", "SampleProblem1"])
     field_data = DictFieldData({'location': location})
     descriptor = VideoDescriptor(system, field_data, Mock())
     descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     descriptor.youtube_id_1_5 = 'rABDYkeK0x8'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8"
     self.assertEqual(create_youtube_string(descriptor), expected)
Ejemplo n.º 9
0
    def test_video_constructor(self):
        """Make sure that all parameters extracted correctly from xml"""
        context = self.item_descriptor.render('student_view').content

        sources = {
            'main': u'example.mp4',
            u'mp4': u'example.mp4',
            u'webm': u'example.webm',
        }

        expected_context = {
            'ajax_url': self.item_descriptor.xmodule_runtime.ajax_url + '/save_user_state',
            'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False),
            'data_dir': getattr(self, 'data_dir', None),
            'display_name': u'A Name',
            'end': 3610.0,
            'id': self.item_descriptor.location.html_id(),
            'show_captions': 'true',
            'handout': None,
            'sources': sources,
            'speed': 'null',
            'general_speed': 1.0,
            'start': 3603.0,
            'saved_video_position': 0.0,
            'sub': u'a_sub_file.srt.sjson',
            'track': None,
            'youtube_streams': create_youtube_string(self.item_descriptor),
            'yt_test_timeout': 1500,
            'yt_api_url': 'www.youtube.com/iframe_api',
            'yt_test_url': 'gdata.youtube.com/feeds/api/videos/',
            'transcript_download_format': 'srt',
            'transcript_download_formats_list': [{'display_name': 'SubRip (.srt) file', 'value': 'srt'}, {'display_name': 'Text (.txt) file', 'value': 'txt'}],
            'transcript_language': u'en',
            'transcript_languages': json.dumps(OrderedDict({"en": "English", "uk":  u"Українська"})),
            'transcript_translation_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript', 'translation'
            ).rstrip('/?'),
            'transcript_available_translations_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript', 'available_translations'
            ).rstrip('/?'),
        }

        self.assertEqual(
            context,
            self.item_descriptor.xmodule_runtime.render_template('video.html', expected_context),
        )
Ejemplo n.º 10
0
    def test_video_constructor(self):
        """Make sure that all parameters extracted correctly from xml"""
        context = self.item_descriptor.render(STUDENT_VIEW).content
        sources = json.dumps([u"example.mp4", u"example.webm"])

        expected_context = {
            "ajax_url": self.item_descriptor.xmodule_runtime.ajax_url + "/save_user_state",
            "autoplay": settings.FEATURES.get("AUTOPLAY_VIDEOS", False),
            "branding_info": None,
            "license": None,
            "cdn_eval": False,
            "cdn_exp_group": None,
            "data_dir": getattr(self, "data_dir", None),
            "display_name": u"A Name",
            "end": 3610.0,
            "id": self.item_descriptor.location.html_id(),
            "show_captions": "true",
            "handout": None,
            "download_video_link": u"example.mp4",
            "sources": sources,
            "speed": "null",
            "general_speed": 1.0,
            "start": 3603.0,
            "saved_video_position": 0.0,
            "sub": u"a_sub_file.srt.sjson",
            "track": None,
            "youtube_streams": create_youtube_string(self.item_descriptor),
            "yt_test_timeout": 1500,
            "yt_api_url": "www.youtube.com/iframe_api",
            "yt_test_url": "gdata.youtube.com/feeds/api/videos/",
            "transcript_download_format": "srt",
            "transcript_download_formats_list": [
                {"display_name": "SubRip (.srt) file", "value": "srt"},
                {"display_name": "Text (.txt) file", "value": "txt"},
            ],
            "transcript_language": u"en",
            "transcript_languages": json.dumps(OrderedDict({"en": "English", "uk": u"Українська"})),
            "transcript_translation_url": self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, "transcript", "translation"
            ).rstrip("/?"),
            "transcript_available_translations_url": self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, "transcript", "available_translations"
            ).rstrip("/?"),
        }

        self.assertEqual(context, self.item_descriptor.xmodule_runtime.render_template("video.html", expected_context))
Ejemplo n.º 11
0
    def test_video_constructor(self):
        """Make sure that all parameters extracted correctly from xml"""
        context = self.item_descriptor.render(STUDENT_VIEW).content
        sources = json.dumps([u'example.mp4', u'example.webm'])

        expected_context = {
            'ajax_url': self.item_descriptor.xmodule_runtime.ajax_url + '/save_user_state',
            'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False),
            'branding_info': None,
            'cdn_eval': False,
            'cdn_exp_group': None,
            'data_dir': getattr(self, 'data_dir', None),
            'display_name': u'A Name',
            'end': 3610.0,
            'id': self.item_descriptor.location.html_id(),
            'show_captions': 'true',
            'handout': None,
            'download_video_link': u'example.mp4',
            'sources': sources,
            'speed': 'null',
            'general_speed': 1.0,
            'start': 3603.0,
            'saved_video_position': 0.0,
            'sub': u'a_sub_file.srt.sjson',
            'track': None,
            'youtube_streams': create_youtube_string(self.item_descriptor),
            'yt_test_timeout': 1500,
            'yt_api_url': 'www.youtube.com/iframe_api',
            'yt_test_url': 'gdata.youtube.com/feeds/api/videos/',
            'transcript_download_format': 'srt',
            'transcript_download_formats_list': [{'display_name': 'SubRip (.srt) file', 'value': 'srt'}, {'display_name': 'Text (.txt) file', 'value': 'txt'}],
            'transcript_language': u'en',
            'transcript_languages': json.dumps(OrderedDict({"en": "English", "uk": u"Українська"})),
            'transcript_translation_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript', 'translation'
            ).rstrip('/?'),
            'transcript_available_translations_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript', 'available_translations'
            ).rstrip('/?'),
        }

        self.assertEqual(
            context,
            self.item_descriptor.xmodule_runtime.render_template('video.html', expected_context),
        )
Ejemplo n.º 12
0
    def test_video_constructor(self):
        """Make sure that all parameters extracted correctly from xml"""
        context = self.item_descriptor.render('student_view').content

        sources = {
            'main': u'example.mp4',
            u'mp4': u'example.mp4',
            u'webm': u'example.webm',
        }

        expected_context = {
            'ajax_url': self.item_descriptor.xmodule_runtime.ajax_url + '/save_user_state',
            'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False),
            'data_dir': getattr(self, 'data_dir', None),
            'display_name': u'A Name',
            'end': 3610.0,
            'id': self.item_descriptor.location.html_id(),
            'show_captions': 'true',
            'sources': sources,
            'speed': 'null',
            'general_speed': 1.0,
            'start': 3603.0,
            'saved_video_position': 0.0,
            'sub': u'a_sub_file.srt.sjson',
            'track': None,
            'youtube_streams': create_youtube_string(self.item_descriptor),
            'yt_test_timeout': 1500,
            'yt_test_url': 'https://gdata.youtube.com/feeds/api/videos/',
            'transcript_language': 'en',
            'transcript_languages': '{"en": "English", "uk": "Ukrainian"}',
            'transcript_translation_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript'
            ).rstrip('/?') + '/translation',
            'transcript_available_translations_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript'
            ).rstrip('/?') + '/available_translations',
        }
        self.assertEqual(
            context,
            self.item_descriptor.xmodule_runtime.render_template('video.html', expected_context),
        )
Ejemplo n.º 13
0
    def test_video_constructor(self):
        """Make sure that all parameters extracted correctly from xml"""
        context = self.item_descriptor.render('student_view').content

        sources = {
            'main': u'example.mp4',
            u'mp4': u'example.mp4',
            u'webm': u'example.webm',
        }

        expected_context = {
            'ajax_url': self.item_descriptor.xmodule_runtime.ajax_url + '/save_user_state',
            'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False),
            'data_dir': getattr(self, 'data_dir', None),
            'display_name': u'A Name',
            'end': 3610.0,
            'id': self.item_descriptor.location.html_id(),
            'show_captions': 'true',
            'sources': sources,
            'speed': 'null',
            'general_speed': 1.0,
            'start': 3603.0,
            'saved_video_position': 0.0,
            'sub': u'a_sub_file.srt.sjson',
            'track': None,
            'youtube_streams': create_youtube_string(self.item_descriptor),
            'yt_test_timeout': 1500,
            'yt_test_url': 'https://gdata.youtube.com/feeds/api/videos/',
            'transcript_language': 'en',
            'transcript_languages': '{"en": "English", "uk": "Ukrainian"}',
            'transcript_translation_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript'
            ).rstrip('/?') + '/translation',
            'transcript_available_translations_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript'
            ).rstrip('/?') + '/available_translations',
        }
        self.assertEqual(
            context,
            self.item_descriptor.xmodule_runtime.render_template('video.html', expected_context),
        )