video module: remove old methods
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# pylint: disable=W0223
|
||||
"""Video is ungraded Xmodule for support video content."""
|
||||
|
||||
import json
|
||||
@@ -94,28 +95,11 @@ class VideoModule(VideoFields, XModule):
|
||||
return parse_time(xmltree.get('from')), parse_time(xmltree.get('to'))
|
||||
|
||||
def handle_ajax(self, dispatch, get):
|
||||
"""Handle ajax calls to this video.
|
||||
TODO (vshnayder): This is not being called right now, so the position
|
||||
is not being saved.
|
||||
"""
|
||||
"""This is not being called right now and we raise 404 error."""
|
||||
log.debug(u"GET {0}".format(get))
|
||||
log.debug(u"DISPATCH {0}".format(dispatch))
|
||||
if dispatch == 'goto_position':
|
||||
self.position = int(float(get['position']))
|
||||
log.info(u"NEW POSITION {0}".format(self.position))
|
||||
return json.dumps({'success': True})
|
||||
raise Http404()
|
||||
|
||||
def get_progress(self):
|
||||
"""TODO (vshnayder): Get and save duration of youtube video, then return
|
||||
fraction watched.
|
||||
(Be careful to notice when video link changes and update)
|
||||
|
||||
For now, we have no way of knowing if the video has even been watched, so
|
||||
just return None.
|
||||
"""
|
||||
return None
|
||||
|
||||
def get_instance_state(self):
|
||||
"""Return information about state (position)."""
|
||||
return json.dumps({'position': self.position})
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Video xmodule tests in mongo."""
|
||||
|
||||
import json
|
||||
|
||||
from . import BaseTestXmodule
|
||||
|
||||
|
||||
@@ -12,27 +10,7 @@ class TestVideo(BaseTestXmodule):
|
||||
TEMPLATE_NAME = "i4x://edx/templates/video/default"
|
||||
DATA = '<video youtube="0.75:JMD_ifUUfsU,1.0:OEoXaMPEzfM,1.25:AKqURZnYqpk,1.50:DYpADpL7jAY"/>'
|
||||
|
||||
def test_handle_ajax_correct_dispatch(self):
|
||||
responses = {
|
||||
user.username: self.clients[user.username].post(
|
||||
self.get_url('goto_position'),
|
||||
{'position': 10},
|
||||
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
|
||||
for user in self.users
|
||||
}
|
||||
|
||||
response_contents = {
|
||||
username: json.loads(response.content) for username, response in
|
||||
responses.items()
|
||||
}
|
||||
|
||||
self.assertTrue(
|
||||
all([
|
||||
content['success']
|
||||
for _, content in response_contents.items()
|
||||
]))
|
||||
|
||||
def test_handle_ajax_incorrect_dispatch(self):
|
||||
def test_handle_ajax_dispatch(self):
|
||||
responses = {
|
||||
user.username: self.clients[user.username].post(
|
||||
self.get_url('whatever'),
|
||||
|
||||
@@ -133,5 +133,3 @@ class VideoModuleUnitTest(unittest.TestCase):
|
||||
self.assertDictEqual(
|
||||
json.loads(module.get_instance_state()),
|
||||
{'position': 0})
|
||||
|
||||
self.assertIsNone(module.get_progress())
|
||||
|
||||
Reference in New Issue
Block a user