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
9a2c96ca
Commit
9a2c96ca
authored
Aug 05, 2014
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4693 from edx/anton/fix-video-tests
Fix failing video tests due to wrong IFRAME_API_RESPONSE
parents
1e1b321b
4f391f66
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
common/djangoapps/terrain/stubs/tests/test_youtube_stub.py
+14
-1
common/djangoapps/terrain/stubs/youtube.py
+10
-3
common/test/acceptance/tests/video/test_video_handout.py
+0
-2
No files found.
common/djangoapps/terrain/stubs/tests/test_youtube_stub.py
View file @
9a2c96ca
...
...
@@ -4,7 +4,7 @@ Unit test for stub YouTube implementation.
import
unittest
import
requests
from
..youtube
import
StubYouTubeService
from
..youtube
import
StubYouTubeService
,
IFRAME_API_RESPONSE
class
StubYouTubeServiceTest
(
unittest
.
TestCase
):
...
...
@@ -74,3 +74,16 @@ class StubYouTubeServiceTest(unittest.TestCase):
# ensure that server config dict is empty after successful reset
self
.
assertEqual
(
self
.
server
.
config
,
{})
def
test_iframe_response_is_up_to_date
(
self
):
"""
Check if IFRAME_API_RESPONSE is up-to-date.
This should prevent issues with IFRAME_API_RESPONSE hard-coding,
when hard-coded version is different from actual.
"""
self
.
assertEqual
(
IFRAME_API_RESPONSE
,
requests
.
get
(
'https://www.youtube.com/iframe_api'
)
.
content
.
strip
(
"
\n
"
)
)
common/djangoapps/terrain/stubs/youtube.py
View file @
9a2c96ca
...
...
@@ -20,13 +20,20 @@ from .http import StubHttpRequestHandler, StubHttpService
import
json
import
time
import
requests
import
textwrap
from
urlparse
import
urlparse
from
collections
import
OrderedDict
# Unless we find a better way, we will get the response from iframe api
# once per suite run, instead of using hardcoded response, to avoid issues.
IFRAME_API_RESPONSE
=
requests
.
get
(
'http://www.youtube.com/iframe_api'
)
.
text
IFRAME_API_RESPONSE
=
textwrap
.
dedent
(
"if (!window['YT']) {var YT = {loading: 0,loaded: 0};}if (!window['YTConfig']) {var YTConfig"
" = {'host': 'http://www.youtube.com'};}if (!YT.loading) {YT.loading = 1;(function(){var l ="
" [];YT.ready = function(f) {if (YT.loaded) {f();} else {l.push(f);}};window.onYTReady ="
" function() {YT.loaded = 1;for (var i = 0; i < l.length; i++) {try {l[i]();} catch (e) "
"{}}};YT.setConfig = function(c) {for (var k in c) {if (c.hasOwnProperty(k)) {YTConfig[k]"
" = c[k];}}};var a = document.createElement('script');a.id = 'www-widgetapi-script';a.src"
" = 'https:' + '//s.ytimg.com/yts/jsbin/www-widgetapi-vflT-xPmY/www-widgetapi.js';a.async"
" = true;var b = document.getElementsByTagName('script')[0];b.parentNode.insertBefore(a, b);})();}"
)
class
StubYouTubeHandler
(
StubHttpRequestHandler
):
...
...
common/test/acceptance/tests/video/test_video_handout.py
View file @
9a2c96ca
...
...
@@ -3,11 +3,9 @@
"""
Acceptance tests for CMS Video Handout.
"""
from
unittest
import
skip
from
.test_studio_video_module
import
CMSVideoBaseTest
@skip
(
'Failing in master in wait_for_video_component_render BLD-1194'
)
class
VideoHandoutTest
(
CMSVideoBaseTest
):
"""
CMS Video Handout Test Class
...
...
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