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
4d469fd9
Commit
4d469fd9
authored
Jan 24, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for jump_to.
parent
26ee9a24
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
lms/djangoapps/courseware/tests/test_views.py
+48
-0
No files found.
lms/djangoapps/courseware/tests/test_views.py
0 → 100644
View file @
4d469fd9
import
unittest
import
logging
from
django.conf
import
settings
from
django.test
import
TestCase
from
django.test.client
import
RequestFactory
from
override_settings
import
override_settings
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
,
_MODULESTORES
from
courseware
import
views
def
xml_store_config
(
data_dir
):
return
{
'default'
:
{
'ENGINE'
:
'xmodule.modulestore.xml.XMLModuleStore'
,
'OPTIONS'
:
{
'data_dir'
:
data_dir
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
}
}
}
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
TEST_DATA_XML_MODULESTORE
=
xml_store_config
(
TEST_DATA_DIR
)
@override_settings
(
MODULESTORE
=
TEST_DATA_XML_MODULESTORE
)
class
TestJumpTo
(
TestCase
):
"""Check the jumpto link for a course"""
def
setUp
(
self
):
self
.
_MODULESTORES
=
{}
# Toy courses should be loaded
self
.
course_name
=
'edX/toy/2012_Fall'
def
test_jumpto_invalid_location
(
self
):
location
=
Location
(
'i4x'
,
'edX'
,
'toy'
,
'NoSuchPlace'
,
None
)
jumpto_url
=
'
%
s/
%
s/jump_to/
%
s'
%
(
'/courses'
,
self
.
course_name
,
location
)
expected
=
'courses/edX/toy/2012_Fall/courseware/Overview/'
response
=
self
.
client
.
get
(
jumpto_url
)
self
.
assertEqual
(
response
.
status_code
,
404
)
def
test_jumpto_from_chapter
(
self
):
location
=
Location
(
'i4x'
,
'edX'
,
'toy'
,
'chapter'
,
'Overview'
)
jumpto_url
=
'
%
s/
%
s/jump_to/
%
s'
%
(
'/courses'
,
self
.
course_name
,
location
)
expected
=
'courses/edX/toy/2012_Fall/courseware/Overview/'
response
=
self
.
client
.
get
(
jumpto_url
)
self
.
assertRedirects
(
response
,
expected
,
status_code
=
302
,
target_status_code
=
302
)
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