Commit b33b5c7b by Vasyl Nakvasiuk Committed by Anton Stupak

Python: videoalpha -> video.

parent dad9f26a
...@@ -107,8 +107,8 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): ...@@ -107,8 +107,8 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
expected_types is the list of elements that should appear on the page. expected_types is the list of elements that should appear on the page.
expected_types and component_types should be similar, but not expected_types and component_types should be similar, but not
exactly the same -- for example, 'videoalpha' in exactly the same -- for example, 'video' in
component_types should cause 'Video Alpha' to be present. component_types should cause 'Video' to be present.
""" """
store = modulestore('direct') store = modulestore('direct')
import_from_xml(store, 'common/test/data/', ['simple']) import_from_xml(store, 'common/test/data/', ['simple'])
...@@ -143,7 +143,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): ...@@ -143,7 +143,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
'Peer Grading Interface']) 'Peer Grading Interface'])
def test_advanced_components_require_two_clicks(self): def test_advanced_components_require_two_clicks(self):
self.check_components_on_page(['videoalpha'], ['Video Alpha']) self.check_components_on_page(['video'], ['Video'])
def test_malformed_edit_unit_request(self): def test_malformed_edit_unit_request(self):
store = modulestore('direct') store = modulestore('direct')
...@@ -1624,7 +1624,7 @@ class MetadataSaveTestCase(ModuleStoreTestCase): ...@@ -1624,7 +1624,7 @@ class MetadataSaveTestCase(ModuleStoreTestCase):
constructor are correctly persisted. constructor are correctly persisted.
""" """
# We should start with a source field, from the XML's <source/> tag # We should start with a source field, from the XML's <source/> tag
self.assertIn('source', own_metadata(self.descriptor)) self.assertIn('html5_sources', own_metadata(self.descriptor))
attrs_to_strip = { attrs_to_strip = {
'show_captions', 'show_captions',
'youtube_id_1_0', 'youtube_id_1_0',
...@@ -1634,6 +1634,7 @@ class MetadataSaveTestCase(ModuleStoreTestCase): ...@@ -1634,6 +1634,7 @@ class MetadataSaveTestCase(ModuleStoreTestCase):
'start_time', 'start_time',
'end_time', 'end_time',
'source', 'source',
'html5_sources',
'track' 'track'
} }
# We strip out all metadata fields to reproduce a bug where # We strip out all metadata fields to reproduce a bug where
...@@ -1646,11 +1647,11 @@ class MetadataSaveTestCase(ModuleStoreTestCase): ...@@ -1646,11 +1647,11 @@ class MetadataSaveTestCase(ModuleStoreTestCase):
field.delete_from(self.descriptor) field.delete_from(self.descriptor)
# Assert that we correctly stripped the field # Assert that we correctly stripped the field
self.assertNotIn('source', own_metadata(self.descriptor)) self.assertNotIn('html5_sources', own_metadata(self.descriptor))
get_modulestore(self.descriptor.location).update_metadata( get_modulestore(self.descriptor.location).update_metadata(
self.descriptor.location, self.descriptor.location,
own_metadata(self.descriptor) own_metadata(self.descriptor)
) )
module = get_modulestore(self.descriptor.location).get_item(self.descriptor.location) module = get_modulestore(self.descriptor.location).get_item(self.descriptor.location)
# Assert that get_item correctly sets the metadata # Assert that get_item correctly sets the metadata
self.assertIn('source', own_metadata(module)) self.assertIn('html5_sources', own_metadata(module))
...@@ -49,7 +49,6 @@ NOTE_COMPONENT_TYPES = ['notes'] ...@@ -49,7 +49,6 @@ NOTE_COMPONENT_TYPES = ['notes']
ADVANCED_COMPONENT_TYPES = [ ADVANCED_COMPONENT_TYPES = [
'annotatable', 'annotatable',
'word_cloud', 'word_cloud',
'videoalpha',
'graphical_slider_tool' 'graphical_slider_tool'
] + OPEN_ENDED_COMPONENT_TYPES + NOTE_COMPONENT_TYPES ] + OPEN_ENDED_COMPONENT_TYPES + NOTE_COMPONENT_TYPES
ADVANCED_COMPONENT_CATEGORY = 'advanced' ADVANCED_COMPONENT_CATEGORY = 'advanced'
......
...@@ -40,7 +40,7 @@ setup( ...@@ -40,7 +40,7 @@ setup(
"timelimit = xmodule.timelimit_module:TimeLimitDescriptor", "timelimit = xmodule.timelimit_module:TimeLimitDescriptor",
"vertical = xmodule.vertical_module:VerticalDescriptor", "vertical = xmodule.vertical_module:VerticalDescriptor",
"video = xmodule.video_module:VideoDescriptor", "video = xmodule.video_module:VideoDescriptor",
"videoalpha = xmodule.videoalpha_module:VideoAlphaDescriptor", "videoalpha = xmodule.video_module:VideoDescriptor",
"videodev = xmodule.backcompat_module:TranslateCustomTagDescriptor", "videodev = xmodule.backcompat_module:TranslateCustomTagDescriptor",
"videosequence = xmodule.seq_module:SequenceDescriptor", "videosequence = xmodule.seq_module:SequenceDescriptor",
"discussion = xmodule.discussion_module:DiscussionDescriptor", "discussion = xmodule.discussion_module:DiscussionDescriptor",
......
...@@ -33,7 +33,7 @@ class TabsEditingDescriptorTestCase(unittest.TestCase): ...@@ -33,7 +33,7 @@ class TabsEditingDescriptorTestCase(unittest.TestCase):
}, },
{ {
'name': "Subtitles", 'name': "Subtitles",
'template': "videoalpha/subtitles.html", 'template': "video/subtitles.html",
}, },
{ {
'name': "Settings", 'name': "Settings",
......
...@@ -16,10 +16,9 @@ from xmodule.gst_module import GraphicalSliderToolDescriptor ...@@ -16,10 +16,9 @@ from xmodule.gst_module import GraphicalSliderToolDescriptor
from xmodule.html_module import HtmlDescriptor from xmodule.html_module import HtmlDescriptor
from xmodule.peer_grading_module import PeerGradingDescriptor from xmodule.peer_grading_module import PeerGradingDescriptor
from xmodule.poll_module import PollDescriptor from xmodule.poll_module import PollDescriptor
from xmodule.video_module import VideoDescriptor
from xmodule.word_cloud_module import WordCloudDescriptor from xmodule.word_cloud_module import WordCloudDescriptor
from xmodule.crowdsource_hinter import CrowdsourceHinterDescriptor from xmodule.crowdsource_hinter import CrowdsourceHinterDescriptor
from xmodule.videoalpha_module import VideoAlphaDescriptor from xmodule.video_module import VideoDescriptor
from xmodule.seq_module import SequenceDescriptor from xmodule.seq_module import SequenceDescriptor
from xmodule.conditional_module import ConditionalDescriptor from xmodule.conditional_module import ConditionalDescriptor
from xmodule.randomize_module import RandomizeDescriptor from xmodule.randomize_module import RandomizeDescriptor
...@@ -35,9 +34,8 @@ LEAF_XMODULES = ( ...@@ -35,9 +34,8 @@ LEAF_XMODULES = (
HtmlDescriptor, HtmlDescriptor,
PeerGradingDescriptor, PeerGradingDescriptor,
PollDescriptor, PollDescriptor,
VideoDescriptor,
# This is being excluded because it has dependencies on django # This is being excluded because it has dependencies on django
#VideoAlphaDescriptor, #VideoDescriptor,
WordCloudDescriptor, WordCloudDescriptor,
) )
......
...@@ -2,22 +2,22 @@ ...@@ -2,22 +2,22 @@
"""Video xmodule tests in mongo.""" """Video xmodule tests in mongo."""
from . import BaseTestXmodule from . import BaseTestXmodule
from .test_videoalpha_xml import SOURCE_XML from .test_video_xml import SOURCE_XML
from django.conf import settings from django.conf import settings
from xmodule.videoalpha_module import _create_youtube_string from xmodule.video_module import _create_youtube_string
class TestVideo(BaseTestXmodule): class TestVideo(BaseTestXmodule):
"""Integration tests: web client + mongo.""" """Integration tests: web client + mongo."""
CATEGORY = "videoalpha" CATEGORY = "video"
DATA = SOURCE_XML DATA = SOURCE_XML
MODEL_DATA = { MODEL_DATA = {
'data': DATA 'data': DATA
} }
def setUp(self): def setUp(self):
# Since the VideoAlphaDescriptor changes `self._model_data`, # Since the VideoDescriptor changes `self._model_data`,
# we need to instantiate `self.item_module` through # we need to instantiate `self.item_module` through
# `self.item_descriptor` rather than directly constructing it # `self.item_descriptor` rather than directly constructing it
super(TestVideo, self).setUp() super(TestVideo, self).setUp()
...@@ -40,7 +40,7 @@ class TestVideo(BaseTestXmodule): ...@@ -40,7 +40,7 @@ class TestVideo(BaseTestXmodule):
]).pop(), ]).pop(),
404) 404)
def test_videoalpha_constructor(self): def test_video_constructor(self):
"""Make sure that all parameters extracted correclty from xml""" """Make sure that all parameters extracted correclty from xml"""
context = self.item_module.get_html() context = self.item_module.get_html()
...@@ -74,7 +74,7 @@ class TestVideoNonYouTube(TestVideo): ...@@ -74,7 +74,7 @@ class TestVideoNonYouTube(TestVideo):
"""Integration tests: web client + mongo.""" """Integration tests: web client + mongo."""
DATA = """ DATA = """
<videoalpha show_captions="true" <video show_captions="true"
display_name="A Name" display_name="A Name"
sub="a_sub_file.srt.sjson" sub="a_sub_file.srt.sjson"
start_time="01:00:03" end_time="01:00:10" start_time="01:00:03" end_time="01:00:10"
...@@ -82,13 +82,13 @@ class TestVideoNonYouTube(TestVideo): ...@@ -82,13 +82,13 @@ class TestVideoNonYouTube(TestVideo):
<source src="example.mp4"/> <source src="example.mp4"/>
<source src="example.webm"/> <source src="example.webm"/>
<source src="example.ogv"/> <source src="example.ogv"/>
</videoalpha> </video>
""" """
MODEL_DATA = { MODEL_DATA = {
'data': DATA 'data': DATA
} }
def test_videoalpha_constructor(self): def test_video_constructor(self):
"""Make sure that if the 'youtube' attribute is omitted in XML, then """Make sure that if the 'youtube' attribute is omitted in XML, then
the template generates an empty string for the YouTube streams. the template generates an empty string for the YouTube streams.
""" """
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# pylint: disable=W0212 # pylint: disable=W0212
"""Test for VideoAlpha Xmodule functional logic. """Test for Video Xmodule functional logic.
These test data read from xml, not from mongo. These test data read from xml, not from mongo.
We have a ModuleStoreTestCase class defined in We have a ModuleStoreTestCase class defined in
...@@ -20,14 +20,14 @@ import unittest ...@@ -20,14 +20,14 @@ import unittest
from django.conf import settings from django.conf import settings
from xmodule.videoalpha_module import ( from xmodule.video_module import (
VideoAlphaDescriptor, _create_youtube_string) VideoDescriptor, _create_youtube_string)
from xmodule.modulestore import Location from xmodule.modulestore import Location
from xmodule.tests import get_test_system, LogicTest from xmodule.tests import get_test_system, LogicTest
SOURCE_XML = """ SOURCE_XML = """
<videoalpha show_captions="true" <video show_captions="true"
display_name="A Name" display_name="A Name"
youtube="0.75:jNCf2gIqpeE,1.0:ZwkTiUPN0mg,1.25:rsq9auxASqI,1.50:kMyNdzVHHgg" youtube="0.75:jNCf2gIqpeE,1.0:ZwkTiUPN0mg,1.25:rsq9auxASqI,1.50:kMyNdzVHHgg"
sub="a_sub_file.srt.sjson" sub="a_sub_file.srt.sjson"
...@@ -36,12 +36,12 @@ SOURCE_XML = """ ...@@ -36,12 +36,12 @@ SOURCE_XML = """
<source src="example.mp4"/> <source src="example.mp4"/>
<source src="example.webm"/> <source src="example.webm"/>
<source src="example.ogv"/> <source src="example.ogv"/>
</videoalpha> </video>
""" """
class VideoAlphaFactory(object): class VideoFactory(object):
"""A helper class to create videoalpha modules with various parameters """A helper class to create video modules with various parameters
for testing. for testing.
""" """
...@@ -50,28 +50,28 @@ class VideoAlphaFactory(object): ...@@ -50,28 +50,28 @@ class VideoAlphaFactory(object):
@staticmethod @staticmethod
def create(): def create():
"""Method return VideoAlpha Xmodule instance.""" """Method return Video Xmodule instance."""
location = Location(["i4x", "edX", "videoalpha", "default", location = Location(["i4x", "edX", "video", "default",
"SampleProblem1"]) "SampleProblem1"])
model_data = {'data': VideoAlphaFactory.sample_problem_xml_youtube, model_data = {'data': VideoFactory.sample_problem_xml_youtube,
'location': location} 'location': location}
system = get_test_system() system = get_test_system()
system.render_template = lambda template, context: context system.render_template = lambda template, context: context
descriptor = VideoAlphaDescriptor(system, model_data) descriptor = VideoDescriptor(system, model_data)
module = descriptor.xmodule(system) module = descriptor.xmodule(system)
return module return module
class VideoAlphaModuleUnitTest(unittest.TestCase): class VideoModuleUnitTest(unittest.TestCase):
"""Unit tests for VideoAlpha Xmodule.""" """Unit tests for Video Xmodule."""
def test_videoalpha_get_html(self): def test_video_get_html(self):
"""Make sure that all parameters extracted correclty from xml""" """Make sure that all parameters extracted correclty from xml"""
module = VideoAlphaFactory.create() module = VideoFactory.create()
module.runtime.render_template = lambda template, context: context module.runtime.render_template = lambda template, context: context
sources = { sources = {
...@@ -98,18 +98,18 @@ class VideoAlphaModuleUnitTest(unittest.TestCase): ...@@ -98,18 +98,18 @@ class VideoAlphaModuleUnitTest(unittest.TestCase):
self.assertEqual(module.get_html(), expected_context) self.assertEqual(module.get_html(), expected_context)
def test_videoalpha_instance_state(self): def test_video_instance_state(self):
module = VideoAlphaFactory.create() module = VideoFactory.create()
self.assertDictEqual( self.assertDictEqual(
json.loads(module.get_instance_state()), json.loads(module.get_instance_state()),
{'position': 0}) {'position': 0})
class VideoAlphaModuleLogicTest(LogicTest): class VideoModuleLogicTest(LogicTest):
"""Tests for logic of VideoAlpha Xmodule.""" """Tests for logic of Video Xmodule."""
descriptor_class = VideoAlphaDescriptor descriptor_class = VideoDescriptor
raw_model_data = { raw_model_data = {
'data': '<video />' 'data': '<video />'
...@@ -117,23 +117,23 @@ class VideoAlphaModuleLogicTest(LogicTest): ...@@ -117,23 +117,23 @@ class VideoAlphaModuleLogicTest(LogicTest):
def test_parse_time(self): def test_parse_time(self):
"""Ensure that times are parsed correctly into seconds.""" """Ensure that times are parsed correctly into seconds."""
output = VideoAlphaDescriptor._parse_time('00:04:07') output = VideoDescriptor._parse_time('00:04:07')
self.assertEqual(output, 247) self.assertEqual(output, 247)
def test_parse_time_none(self): def test_parse_time_none(self):
"""Check parsing of None.""" """Check parsing of None."""
output = VideoAlphaDescriptor._parse_time(None) output = VideoDescriptor._parse_time(None)
self.assertEqual(output, '') self.assertEqual(output, '')
def test_parse_time_empty(self): def test_parse_time_empty(self):
"""Check parsing of the empty string.""" """Check parsing of the empty string."""
output = VideoAlphaDescriptor._parse_time('') output = VideoDescriptor._parse_time('')
self.assertEqual(output, '') self.assertEqual(output, '')
def test_parse_youtube(self): def test_parse_youtube(self):
"""Test parsing old-style Youtube ID strings into a dict.""" """Test parsing old-style Youtube ID strings into a dict."""
youtube_str = '0.75:jNCf2gIqpeE,1.00:ZwkTiUPN0mg,1.25:rsq9auxASqI,1.50:kMyNdzVHHgg' youtube_str = '0.75:jNCf2gIqpeE,1.00:ZwkTiUPN0mg,1.25:rsq9auxASqI,1.50:kMyNdzVHHgg'
output = VideoAlphaDescriptor._parse_youtube(youtube_str) output = VideoDescriptor._parse_youtube(youtube_str)
self.assertEqual(output, {'0.75': 'jNCf2gIqpeE', self.assertEqual(output, {'0.75': 'jNCf2gIqpeE',
'1.00': 'ZwkTiUPN0mg', '1.00': 'ZwkTiUPN0mg',
'1.25': 'rsq9auxASqI', '1.25': 'rsq9auxASqI',
...@@ -145,7 +145,7 @@ class VideoAlphaModuleLogicTest(LogicTest): ...@@ -145,7 +145,7 @@ class VideoAlphaModuleLogicTest(LogicTest):
empty string. empty string.
""" """
youtube_str = '0.75:jNCf2gIqpeE' youtube_str = '0.75:jNCf2gIqpeE'
output = VideoAlphaDescriptor._parse_youtube(youtube_str) output = VideoDescriptor._parse_youtube(youtube_str)
self.assertEqual(output, {'0.75': 'jNCf2gIqpeE', self.assertEqual(output, {'0.75': 'jNCf2gIqpeE',
'1.00': '', '1.00': '',
'1.25': '', '1.25': '',
...@@ -158,8 +158,8 @@ class VideoAlphaModuleLogicTest(LogicTest): ...@@ -158,8 +158,8 @@ class VideoAlphaModuleLogicTest(LogicTest):
youtube_str = '1.00:p2Q6BrNhdh8' youtube_str = '1.00:p2Q6BrNhdh8'
youtube_str_hack = '1.0:p2Q6BrNhdh8' youtube_str_hack = '1.0:p2Q6BrNhdh8'
self.assertEqual( self.assertEqual(
VideoAlphaDescriptor._parse_youtube(youtube_str), VideoDescriptor._parse_youtube(youtube_str),
VideoAlphaDescriptor._parse_youtube(youtube_str_hack) VideoDescriptor._parse_youtube(youtube_str_hack)
) )
def test_parse_youtube_empty(self): def test_parse_youtube_empty(self):
...@@ -167,7 +167,7 @@ class VideoAlphaModuleLogicTest(LogicTest): ...@@ -167,7 +167,7 @@ class VideoAlphaModuleLogicTest(LogicTest):
Some courses have empty youtube attributes, so we should handle Some courses have empty youtube attributes, so we should handle
that well. that well.
""" """
self.assertEqual(VideoAlphaDescriptor._parse_youtube(''), self.assertEqual(VideoDescriptor._parse_youtube(''),
{'0.75': '', {'0.75': '',
'1.00': '', '1.00': '',
'1.25': '', '1.25': '',
......
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