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
7afcb934
Commit
7afcb934
authored
May 27, 2014
by
Muhammad Ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check YouTube Availabitlity for Video Tests
parent
721732bf
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
89 additions
and
21 deletions
+89
-21
cms/djangoapps/contentstore/features/transcripts.feature
+1
-1
cms/djangoapps/contentstore/features/video.feature
+1
-1
cms/djangoapps/contentstore/features/video.py
+0
-4
cms/djangoapps/contentstore/features/video_editor.feature
+1
-1
cms/djangoapps/contentstore/features/video_handout.feature
+1
-1
common/djangoapps/terrain/__init__.py
+5
-4
common/djangoapps/terrain/setup_prereqs.py
+75
-6
lms/djangoapps/courseware/features/lti.feature
+1
-1
lms/djangoapps/courseware/features/problems.feature
+1
-1
lms/djangoapps/courseware/features/video.feature
+1
-1
lms/djangoapps/courseware/features/video.py
+2
-0
No files found.
cms/djangoapps/contentstore/features/transcripts.feature
View file @
7afcb934
@shard_3
@shard_3
@requires_stub_youtube
Feature
:
CMS Transcripts
As a course author, I want to be able to create video components
...
...
cms/djangoapps/contentstore/features/video.feature
View file @
7afcb934
@shard_3
@shard_3
@requires_stub_youtube
Feature
:
CMS Video Component
As a course author, I want to be able to view my created videos in Studio
...
...
cms/djangoapps/contentstore/features/video.py
View file @
7afcb934
# pylint: disable=C0111
from
lettuce
import
world
,
step
from
nose.tools
import
assert_less
from
xmodule.modulestore
import
Location
from
contentstore.utils
import
get_modulestore
from
selenium.webdriver.common.keys
import
Keys
...
...
@@ -22,7 +20,6 @@ SELECTORS = {
# We should wait 300 ms for event handler invocation + 200ms for safety.
DELAY
=
0.5
@step
(
'youtube stub server (.*) YouTube API'
)
def
configure_youtube_api
(
_step
,
action
):
action
=
action
.
strip
()
...
...
@@ -33,7 +30,6 @@ def configure_youtube_api(_step, action):
else
:
raise
ValueError
(
'Parameter `action` should be one of "proxies" or "blocks".'
)
@step
(
'I have created a Video component$'
)
def
i_created_a_video_component
(
_step
):
...
...
cms/djangoapps/contentstore/features/video_editor.feature
View file @
7afcb934
@shard_1
@shard_1
@requires_stub_youtube
Feature
:
CMS Video Component Editor
As a course author, I want to be able to create video components
...
...
cms/djangoapps/contentstore/features/video_handout.feature
View file @
7afcb934
@shard_3
@shard_3
@requires_stub_youtube
Feature
:
CMS Video Component Handout
As a course author, I want to be able to create video handout
...
...
common/djangoapps/terrain/__init__.py
View file @
7afcb934
# Use this as your lettuce terrain file so that the common steps
# across all lms apps can be put in terrain/common
# See https://groups.google.com/forum/?fromgroups=#!msg/lettuce-users/5VyU9B4HcX8/USgbGIJdS5QJ
from
terrain.browser
import
*
from
terrain.steps
import
*
from
terrain.factories
import
*
from
terrain.start_stubs
import
*
from
terrain.browser
import
*
# pylint: disable=W0401
from
terrain.steps
import
*
# pylint: disable=W0401
from
terrain.factories
import
*
# pylint: disable=W0401
from
terrain.setup_prereqs
import
*
# pylint: disable=W0401
common/djangoapps/terrain/s
tart_stub
s.py
→
common/djangoapps/terrain/s
etup_prereq
s.py
View file @
7afcb934
"""
Initialize and teardown stub and video HTTP services for use in acceptance tests.
Set up the prequisites for acceptance tests.
This includes initialization and teardown for stub and video HTTP services
and checking for external URLs that need to be accessible and responding.
"""
from
lettuce
import
before
,
after
,
world
from
django.conf
import
settings
...
...
@@ -8,6 +12,9 @@ from terrain.stubs.xqueue import StubXQueueService
from
terrain.stubs.lti
import
StubLtiService
from
terrain.stubs.video_source
import
VideoSourceHttpService
import
re
import
requests
SERVICES
=
{
"youtube"
:
{
"port"
:
settings
.
YOUTUBE_PORT
,
"class"
:
StubYouTubeService
},
...
...
@@ -15,6 +22,15 @@ SERVICES = {
"lti"
:
{
"port"
:
settings
.
LTI_PORT
,
"class"
:
StubLtiService
},
}
YOUTUBE_API_URLS
=
{
'main'
:
'https://www.youtube.com/'
,
'player'
:
'http://www.youtube.com/iframe_api'
,
'metadata'
:
'http://gdata.youtube.com/feeds/api/videos/'
,
# For transcripts, you need to check an actual video, so we will
# just specify our default video and see if that one is available.
'transcript'
:
'http://video.google.com/timedtext?lang=en&v=OEoXaMPEzfM'
,
}
@before.all
# pylint: disable=E1101
def
start_video_server
():
...
...
@@ -38,21 +54,74 @@ def stop_video_server(_total):
@before.each_scenario
def
start_stubs
(
_
scenario
):
def
process_requires_tags
(
scenario
):
"""
Start each stub service running on a local port.
Process the scenario tags to make sure that any
requirements are met prior to that scenario
being executed.
Scenario tags must be named with this convention:
@requires_stub_bar, where 'bar' is the name of the stub service to start
if 'bar' is 'youtube'
if 'youtube' is not available Then
DON'T start youtube stub server
ALSO DON'T start any other stub server BECAUSE we will SKIP this Scenario so no need to start any stub
else
start the stub server
"""
tag_re
=
re
.
compile
(
'requires_stub_(?P<server>[^_]+)'
)
for
tag
in
scenario
.
tags
:
requires
=
tag_re
.
match
(
tag
)
if
requires
:
if
requires
.
group
(
'server'
)
==
'youtube'
:
if
not
is_youtube_available
(
scenario
,
YOUTUBE_API_URLS
):
return
start_stub
(
requires
.
group
(
'server'
))
def
start_stub
(
name
):
"""
Start the required stub service running on a local port.
Since these services can be reconfigured on the fly,
stop and restart them on a scenario basis.
we start them on a scenario basis when needed and
stop them at the end of the scenario.
"""
for
name
,
service
in
SERVICES
.
iteritems
():
service
=
SERVICES
.
get
(
name
,
None
)
if
service
:
fake_server
=
service
[
'class'
](
port_num
=
service
[
'port'
])
setattr
(
world
,
name
,
fake_server
)
def
is_youtube_available
(
scenario
,
urls
):
"""
Check if the required youtube urls are available.
If they are not, then skip the scenario.
"""
for
name
,
url
in
urls
.
iteritems
():
response
=
requests
.
get
(
url
,
allow_redirects
=
False
)
status
=
response
.
status_code
if
status
!=
200
:
print
"ERROR: YouTube {0} service not available. Status code: {1}"
.
format
(
name
,
status
)
# This is a hackish way to skip a test in lettuce as there is
# no proper way to skip a test conditionally
scenario
.
steps
=
[]
# No need to check all the URLs
return
False
return
True
@after.each_scenario
def
stop_stubs
(
_scenario
):
"""
Shut down
each stub service
.
Shut down
any stub services that were started up for the scenario
.
"""
for
name
in
SERVICES
.
keys
():
stub_server
=
getattr
(
world
,
name
,
None
)
...
...
lms/djangoapps/courseware/features/lti.feature
View file @
7afcb934
@shard_1
@shard_1
@requires_stub_lti
Feature
:
LMS.LTI component
As a student, I want to view LTI component in LMS.
...
...
lms/djangoapps/courseware/features/problems.feature
View file @
7afcb934
@shard_1
@shard_1
@requires_stub_xqueue
Feature
:
LMS.Answer problems
As a student in an edX course
In order to test my understanding of the material
...
...
lms/djangoapps/courseware/features/video.feature
View file @
7afcb934
@shard_2
@shard_2
@requires_stub_youtube
Feature
:
LMS.Video component
As a student, I want to view course videos in LMS
...
...
lms/djangoapps/courseware/features/video.py
View file @
7afcb934
...
...
@@ -14,6 +14,7 @@ from cache_toolbox.core import del_cached_content
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.django
import
contentstore
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
LANGUAGES
=
settings
.
ALL_LANGUAGES
VIDEO_SOURCE_PORT
=
settings
.
VIDEO_SOURCE_PORT
...
...
@@ -55,6 +56,7 @@ VIDEO_MENUS = {
coursenum
=
'test_course'
@before.each_scenario
def
setUp
(
scenario
):
world
.
video_sequences
=
{}
...
...
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