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
e24eb3e4
Commit
e24eb3e4
authored
Jul 22, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added explicit unit test to verify the link rewriting
parent
80e0b993
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
1 deletions
+27
-1
common/test/data/toy/course/2012_Fall.xml
+1
-1
common/test/data/toy/html/toyjumpto.html
+0
-0
common/test/data/toy/html/toyjumpto.xml
+0
-0
lms/djangoapps/courseware/tests/test_module_render.py
+26
-0
No files found.
common/test/data/toy/course/2012_Fall.xml
View file @
e24eb3e4
...
...
@@ -3,7 +3,7 @@
<chapter
url_name=
"Overview"
>
<videosequence
url_name=
"Toy_Videos"
>
<html
url_name=
"secret:toylab"
/>
<html
url_name=
"
secret:
toyjumpto"
/>
<html
url_name=
"toyjumpto"
/>
<video
url_name=
"Video_Resources"
youtube_id_1_0=
"1bK-WdDi6Qw"
display_name=
"Video Resources"
/>
</videosequence>
<video
url_name=
"Welcome"
youtube_id_1_0=
"p2Q6BrNhdh8"
display_name=
"Welcome"
/>
...
...
common/test/data/toy/html/
secret/
toyjumpto.html
→
common/test/data/toy/html/toyjumpto.html
View file @
e24eb3e4
File moved
common/test/data/toy/html/
secret/
toyjumpto.xml
→
common/test/data/toy/html/toyjumpto.xml
View file @
e24eb3e4
File moved
lms/djangoapps/courseware/tests/test_module_render.py
View file @
e24eb3e4
...
...
@@ -17,6 +17,8 @@ from courseware.tests.tests import LoginEnrollmentTestCase
from
courseware.model_data
import
ModelDataCache
from
modulestore_config
import
TEST_DATA_XML_MODULESTORE
from
courseware.courses
import
get_course_with_access
from
.factories
import
UserFactory
...
...
@@ -50,6 +52,30 @@ class ModuleRenderTestCase(LoginEnrollmentTestCase):
self
.
assertIsNone
(
render
.
get_module
(
'dummyuser'
,
None
,
'invalid location'
,
None
,
None
))
def
test_module_render_with_jump_to_id
(
self
):
"""
This test validates that the /jump_to_id/<id> shorthand for intracourse linking works assertIn
expected. Note there's a HTML element in the 'toy' course with the url_name 'toyjumpto' which
defines this linkage
"""
mock_request
=
MagicMock
()
mock_request
.
user
=
self
.
mock_user
course
=
get_course_with_access
(
self
.
mock_user
,
self
.
course_id
,
'load'
)
model_data_cache
=
ModelDataCache
.
cache_for_descriptor_descendents
(
self
.
course_id
,
self
.
mock_user
,
course
,
depth
=
2
)
module
=
render
.
get_module
(
self
.
mock_user
,
mock_request
,
[
'i4x'
,
'edX'
,
'toy'
,
'html'
,
'toyjumpto'
],
model_data_cache
,
self
.
course_id
)
# get the rendered HTML output which should have the rewritten link
html
=
module
.
get_html
()
# See if the url got rewritten to the target link
# note if the URL mapping changes then this assertion will break
self
.
assertIn
(
'/courses/'
+
self
.
course_id
+
'/jump_to_id/vertical_test'
,
html
)
def
test_modx_dispatch
(
self
):
self
.
assertRaises
(
Http404
,
render
.
modx_dispatch
,
'dummy'
,
'dummy'
,
'invalid Location'
,
'dummy'
)
...
...
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