video module: remove old methods

This commit is contained in:
Vasyl Nakvasiuk
2013-06-03 11:11:08 +03:00
parent 68716f99cc
commit 45e32107e7
3 changed files with 3 additions and 43 deletions

View File

@@ -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})

View File

@@ -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'),

View File

@@ -133,5 +133,3 @@ class VideoModuleUnitTest(unittest.TestCase):
self.assertDictEqual(
json.loads(module.get_instance_state()),
{'position': 0})
self.assertIsNone(module.get_progress())