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
668134de
Commit
668134de
authored
Apr 03, 2014
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3169 from edx/alex/fix_more_flaky_tests
Alex/fix more flaky tests
parents
41695def
cf3e2c86
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
11 deletions
+19
-11
cms/djangoapps/contentstore/features/video.feature
+3
-3
cms/djangoapps/contentstore/features/video.py
+6
-6
common/djangoapps/terrain/start_stubs.py
+5
-1
common/djangoapps/terrain/stubs/youtube.py
+1
-1
lms/djangoapps/courseware/features/video.py
+4
-0
No files found.
cms/djangoapps/contentstore/features/video.feature
View file @
668134de
...
...
@@ -5,7 +5,7 @@ Feature: CMS Video Component
# 1
Scenario
:
YouTube stub server proxies YouTube API correctly
Given
youtube stub server proxies YouTube API
Given
I have created a Video component
And
I have created a Video component
Then
I can see video button
"play"
And
I click video button
"play"
Then
I can see video button
"pause"
...
...
@@ -13,8 +13,8 @@ Feature: CMS Video Component
# 2
Scenario
:
YouTube stub server can block YouTube API
Given
youtube stub server blocks YouTube API
Given
I have created a Video component
Given
We explicitly wait for YouTube API to not load
And
I have created a Video component
And
I wait for
"3"
seconds
Then
I do not see video button
"play"
# 3
...
...
cms/djangoapps/contentstore/features/video.py
View file @
668134de
# 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
...
...
@@ -32,13 +33,11 @@ def configure_youtube_api(_step, action):
raise
ValueError
(
'Parameter `action` should be one of "proxies" or "blocks".'
)
@step
(
'We explicitly wait for YouTube API to not load$'
)
def
wait_for_youtube_api_fail
(
_step
):
world
.
wait
(
3
)
@step
(
'I have created a Video component$'
)
def
i_created_a_video_component
(
_step
):
assert_less
(
world
.
youtube
.
config
[
'youtube_api_response'
]
.
status_code
,
400
,
"Real Youtube server is unavailable"
)
world
.
create_course_with_unit
()
world
.
create_component_instance
(
step
=
_step
,
...
...
@@ -51,7 +50,8 @@ def i_created_a_video_component(_step):
world
.
wait_for_present
(
'.is-initialized'
)
world
.
wait
(
DELAY
)
world
.
wait_for_invisible
(
SELECTORS
[
'spinner'
])
if
not
world
.
youtube
.
config
.
get
(
'youtube_api_blocked'
):
world
.
wait_for_visible
(
SELECTORS
[
'controls'
])
@step
(
'I have created a Video component with subtitles$'
)
def
i_created_a_video_with_subs
(
_step
):
...
...
common/djangoapps/terrain/start_stubs.py
View file @
668134de
"""
Initialize and teardown fake HTTP services for use in acceptance tests.
"""
import
requests
from
lettuce
import
before
,
after
,
world
from
django.conf
import
settings
from
terrain.stubs.youtube
import
StubYouTubeService
...
...
@@ -14,6 +14,8 @@ SERVICES = {
"lti"
:
{
"port"
:
settings
.
LTI_PORT
,
"class"
:
StubLtiService
},
}
YOUTUBE_API_RESPONSE
=
requests
.
get
(
'http://www.youtube.com/iframe_api'
)
@before.each_scenario
def
start_stubs
(
_
):
...
...
@@ -22,6 +24,8 @@ def start_stubs(_):
"""
for
name
,
service
in
SERVICES
.
iteritems
():
fake_server
=
service
[
'class'
](
port_num
=
service
[
'port'
])
if
name
==
'youtube'
:
fake_server
.
config
[
'youtube_api_response'
]
=
YOUTUBE_API_RESPONSE
setattr
(
world
,
name
,
fake_server
)
...
...
common/djangoapps/terrain/stubs/youtube.py
View file @
668134de
...
...
@@ -80,7 +80,7 @@ class StubYouTubeHandler(StubHttpRequestHandler):
if
self
.
server
.
config
.
get
(
'youtube_api_blocked'
):
self
.
send_response
(
404
,
content
=
''
,
headers
=
{
'Content-type'
:
'text/plain'
})
else
:
response
=
requests
.
get
(
'http://www.youtube.com/iframe_api'
)
response
=
self
.
server
.
config
[
'youtube_api_response'
]
self
.
send_response
(
200
,
content
=
response
.
text
,
headers
=
{
'Content-type'
:
'text/html'
})
else
:
...
...
lms/djangoapps/courseware/features/video.py
View file @
668134de
...
...
@@ -6,6 +6,7 @@ import json
import
os
import
time
import
requests
from
nose.tools
import
assert_less
from
common
import
i_am_registered_for_the_course
,
visit_scenario_item
from
django.utils.translation
import
ugettext
as
_
from
django.conf
import
settings
...
...
@@ -159,6 +160,9 @@ def add_videos_to_course(course, player_mode=None, display_names=None, hashes=No
def
add_video_to_course
(
course
,
parent_location
=
None
,
player_mode
=
None
,
data
=
None
,
display_name
=
'Video'
):
assert_less
(
world
.
youtube
.
config
[
'youtube_api_response'
]
.
status_code
,
400
,
"Real Youtube server is unavailable"
)
if
not
parent_location
:
parent_location
=
add_vertical_to_course
(
course
)
kwargs
=
get_metadata
(
parent_location
,
player_mode
,
data
,
display_name
=
display_name
)
...
...
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