Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3fc19a35
Commit
3fc19a35
authored
10 years ago
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Serve video HTML5 sources locally for acceptance tests
parent
f1eefc11
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
100 additions
and
12 deletions
+100
-12
cms/envs/test.py
+1
-0
common/djangoapps/terrain/start_stubs.py
+28
-3
common/djangoapps/terrain/stubs/start.py
+2
-0
common/djangoapps/terrain/stubs/video_source.py
+48
-0
common/test/acceptance/tests/test_video_module.py
+5
-4
lms/djangoapps/courseware/features/video.py
+5
-5
lms/envs/test.py
+1
-0
rakelib/bok_choy.rake
+8
-0
test_root/data/video/gizmo.mp99
+2
-0
No files found.
cms/envs/test.py
View file @
3fc19a35
...
...
@@ -175,6 +175,7 @@ LETTUCE_SERVER_PORT = 8003
XQUEUE_PORT
=
8040
YOUTUBE_PORT
=
8031
LTI_PORT
=
8765
VIDEO_SOURCE_PORT
=
8777
################### Make tests faster
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/terrain/start_stubs.py
View file @
3fc19a35
"""
Initialize and teardown
fake
HTTP services for use in acceptance tests.
Initialize and teardown
stub and video
HTTP services for use in acceptance tests.
"""
import
requests
from
lettuce
import
before
,
after
,
world
...
...
@@ -7,6 +7,8 @@ from django.conf import settings
from
terrain.stubs.youtube
import
StubYouTubeService
from
terrain.stubs.xqueue
import
StubXQueueService
from
terrain.stubs.lti
import
StubLtiService
from
terrain.stubs.video_source
import
VideoSourceHttpService
SERVICES
=
{
"youtube"
:
{
"port"
:
settings
.
YOUTUBE_PORT
,
"class"
:
StubYouTubeService
},
...
...
@@ -17,10 +19,33 @@ SERVICES = {
YOUTUBE_API_RESPONSE
=
requests
.
get
(
'http://www.youtube.com/iframe_api'
)
@before.all
# pylint: disable=E1101
def
start_video_server
():
"""
Serve the HTML5 Video Sources from a local port
"""
video_source_dir
=
'{}/data/video'
.
format
(
settings
.
TEST_ROOT
)
video_server
=
VideoSourceHttpService
(
port_num
=
settings
.
VIDEO_SOURCE_PORT
)
video_server
.
config
[
'root_dir'
]
=
video_source_dir
setattr
(
world
,
'video_source'
,
video_server
)
@after.all
# pylint: disable=E1101
def
stop_video_server
(
_total
):
"""
Stop the HTML5 Video Source server after all tests have executed
"""
video_server
=
getattr
(
world
,
'video_source'
,
None
)
if
video_server
:
video_server
.
shutdown
()
@before.each_scenario
def
start_stubs
(
_
):
def
start_stubs
(
_
scenario
):
"""
Start each stub service running on a local port.
Since these services can be reconfigured on the fly,
stop and restart them on a scenario basis.
"""
for
name
,
service
in
SERVICES
.
iteritems
():
fake_server
=
service
[
'class'
](
port_num
=
service
[
'port'
])
...
...
@@ -30,7 +55,7 @@ def start_stubs(_):
@after.each_scenario
def
stop_stubs
(
_
):
def
stop_stubs
(
_
scenario
):
"""
Shut down each stub service.
"""
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/terrain/stubs/start.py
View file @
3fc19a35
...
...
@@ -9,6 +9,7 @@ from .xqueue import StubXQueueService
from
.youtube
import
StubYouTubeService
from
.ora
import
StubOraService
from
.lti
import
StubLtiService
from
.video_source
import
VideoSourceHttpService
USAGE
=
"USAGE: python -m stubs.start SERVICE_NAME PORT_NUM [CONFIG_KEY=CONFIG_VAL, ...]"
...
...
@@ -19,6 +20,7 @@ SERVICES = {
'ora'
:
StubOraService
,
'comments'
:
StubCommentsService
,
'lti'
:
StubLtiService
,
'video'
:
VideoSourceHttpService
,
}
# Log to stdout, including debug messages
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/terrain/stubs/video_source.py
0 → 100644
View file @
3fc19a35
"""
Serve HTML5 video sources for acceptance tests
"""
from
SimpleHTTPServer
import
SimpleHTTPRequestHandler
from
.http
import
StubHttpService
from
contextlib
import
contextmanager
import
os
from
logging
import
getLogger
LOGGER
=
getLogger
(
__name__
)
class
VideoSourceRequestHandler
(
SimpleHTTPRequestHandler
):
"""
Request handler for serving video sources locally.
"""
def
translate_path
(
self
,
path
):
"""
Remove any extra parameters from the path.
For example /gizmo.mp4?1397160769634
becomes /gizmo.mp4
"""
root_dir
=
self
.
server
.
config
.
get
(
'root_dir'
)
path
=
'{}{}'
.
format
(
root_dir
,
path
)
return
path
.
split
(
'?'
)[
0
]
class
VideoSourceHttpService
(
StubHttpService
):
"""
Simple HTTP server for serving HTML5 Video sources locally for tests
"""
HANDLER_CLASS
=
VideoSourceRequestHandler
def
__init__
(
self
,
port_num
=
0
):
@contextmanager
def
_remember_cwd
():
"""
Files are automatically served from the current directory
so we need to change it, start the server, then set it back.
"""
curdir
=
os
.
getcwd
()
try
:
yield
finally
:
os
.
chdir
(
curdir
)
with
_remember_cwd
():
StubHttpService
.
__init__
(
self
,
port_num
=
port_num
)
This diff is collapsed.
Click to expand it.
common/test/acceptance/tests/test_video_module.py
View file @
3fc19a35
...
...
@@ -11,15 +11,16 @@ from ..pages.studio.auto_auth import AutoAuthPage
from
..pages.lms.course_info
import
CourseInfoPage
from
..fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
VIDEO_SOURCE_PORT
=
8777
HTML5_SOURCES
=
[
'http
s://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.mp4'
,
'http
s://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.webm'
,
'http
s://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.ogv'
,
'http
://localhost:{0}/gizmo.mp4'
.
format
(
VIDEO_SOURCE_PORT
)
,
'http
://localhost:{0}/gizmo.webm'
.
format
(
VIDEO_SOURCE_PORT
)
,
'http
://localhost:{0}/gizmo.ogv'
.
format
(
VIDEO_SOURCE_PORT
)
,
]
HTML5_SOURCES_INCORRECT
=
[
'http
s://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.mp99'
,
'http
://localhost:{0}/gizmo.mp99'
.
format
(
VIDEO_SOURCE_PORT
)
,
]
HTML5_METADATA
=
{
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/courseware/features/video.py
View file @
3fc19a35
...
...
@@ -16,14 +16,14 @@ from xmodule.contentstore.django import contentstore
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
LANGUAGES
=
settings
.
ALL_LANGUAGES
VIDEO_SOURCE_PORT
=
settings
.
VIDEO_SOURCE_PORT
############### ACTIONS ####################
HTML5_SOURCES
=
[
'http
s://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.mp4'
,
'http
s://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.webm'
,
'http
s://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.ogv'
,
'http
://localhost:{0}/gizmo.mp4'
.
format
(
VIDEO_SOURCE_PORT
)
,
'http
://localhost:{0}/gizmo.webm'
.
format
(
VIDEO_SOURCE_PORT
)
,
'http
://localhost:{0}/gizmo.ogv'
.
format
(
VIDEO_SOURCE_PORT
)
,
]
FLASH_SOURCES
=
{
...
...
@@ -34,7 +34,7 @@ FLASH_SOURCES = {
}
HTML5_SOURCES_INCORRECT
=
[
'http
s://s3.amazonaws.com/edx-course-videos/edx-intro/edX-FA12-cware-1_100.mp99'
,
'http
://localhost:{0}/gizmo.mp99'
.
format
(
VIDEO_SOURCE_PORT
)
,
]
VIDEO_BUTTONS
=
{
...
...
This diff is collapsed.
Click to expand it.
lms/envs/test.py
View file @
3fc19a35
...
...
@@ -257,6 +257,7 @@ LETTUCE_SERVER_PORT = 8003
XQUEUE_PORT
=
8040
YOUTUBE_PORT
=
8031
LTI_PORT
=
8765
VIDEO_SOURCE_PORT
=
8777
################### Make tests faster
...
...
This diff is collapsed.
Click to expand it.
rakelib/bok_choy.rake
View file @
3fc19a35
...
...
@@ -23,6 +23,8 @@ BOK_CHOY_XUNIT_REPORT = File.join(BOK_CHOY_REPORT_DIR, "xunit.xml")
BOK_CHOY_COVERAGE_RC
=
File
.
join
(
BOK_CHOY_DIR
,
".coveragerc"
)
directory
BOK_CHOY_REPORT_DIR
# Directory that videos are served from
VIDEO_SOURCE_DIR
=
File
.
join
(
REPO_ROOT
,
"test_root"
,
"data"
,
"video"
)
BOK_CHOY_SERVERS
=
{
:lms
=>
{
:port
=>
8003
,
:log
=>
File
.
join
(
BOK_CHOY_LOG_DIR
,
"bok_choy_lms.log"
)
},
...
...
@@ -46,6 +48,12 @@ BOK_CHOY_STUBS = {
:comments
=>
{
:port
=>
4567
,
:log
=>
File
.
join
(
BOK_CHOY_LOG_DIR
,
"bok_choy_comments.log"
)
},
:video
=>
{
:port
=>
8777
,
:log
=>
File
.
join
(
BOK_CHOY_LOG_DIR
,
"bok_choy_video_sources.log"
),
:config
=>
"root_dir=
#{
VIDEO_SOURCE_DIR
}
"
}
}
...
...
This diff is collapsed.
Click to expand it.
test_root/data/video/gizmo.mp99
0 → 100644
View file @
3fc19a35
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>
AccessDenied
</Code><Message>
Access Denied
</Message><RequestId>
1205EB22685DC2E7
</RequestId><HostId>
/a61gfYpYdzvEXubtCRZCM8u3hsEBjRxcZ+aCP0VXVcL2oQmWo2bZ1aAocxXiZ+S
</HostId></Error>
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment