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
855c8bb7
Commit
855c8bb7
authored
Jan 29, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unit test for tab reordering
parent
5a389551
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletions
+29
-1
cms/djangoapps/contentstore/tests/tests.py
+28
-0
cms/djangoapps/contentstore/views.py
+0
-1
common/test/data/full/policies/6.002_Spring_2012.json
+1
-0
No files found.
cms/djangoapps/contentstore/tests/tests.py
View file @
855c8bb7
...
@@ -350,6 +350,34 @@ class ContentStoreTest(TestCase):
...
@@ -350,6 +350,34 @@ class ContentStoreTest(TestCase):
def
test_edit_unit_full
(
self
):
def
test_edit_unit_full
(
self
):
self
.
check_edit_unit
(
'full'
)
self
.
check_edit_unit
(
'full'
)
def
test_static_tab_reordering
(
self
):
import_from_xml
(
modulestore
(),
'common/test/data/'
,
[
'full'
])
# reverse the ordering
tabs
=
{
'tabs'
:
[
'i4x://edX/full/static_tab/resources'
,
'i4x://edX/full/static_tab/syllabus'
]
}
resp
=
self
.
client
.
post
(
reverse
(
'reorder_tabs'
),
json
.
dumps
(
tabs
),
"application/json"
)
ms
=
modulestore
(
'direct'
)
course
=
ms
.
get_item
(
Location
([
'i4x'
,
'edX'
,
'full'
,
'course'
,
'6.002_Spring_2012'
,
None
]))
# compare to make sure that the tabs information is in the expected order after the server call
resource_idx
=
0
syllabus_idx
=
0
idx
=
0
for
tab
in
course
.
tabs
:
if
tab
[
'type'
]
==
'static_tab'
:
if
tab
[
'url_slug'
]
==
'resources'
:
resource_idx
=
idx
elif
tab
[
'url_slug'
]
==
'syllabus'
:
syllabus_idx
=
idx
idx
+=
1
self
.
assertLess
(
resource_idx
,
syllabus_idx
)
def
test_about_overrides
(
self
):
def
test_about_overrides
(
self
):
'''
'''
This test case verifies that a course can use specialized override for about data, e.g. /about/Fall_2012/effort.html
This test case verifies that a course can use specialized override for about data, e.g. /about/Fall_2012/effort.html
...
...
cms/djangoapps/contentstore/views.py
View file @
855c8bb7
...
@@ -908,7 +908,6 @@ def edit_static(request, org, course, coursename):
...
@@ -908,7 +908,6 @@ def edit_static(request, org, course, coursename):
@expect_json
@expect_json
def
reorder_tabs
(
request
):
def
reorder_tabs
(
request
):
tabs
=
request
.
POST
[
'tabs'
]
tabs
=
request
.
POST
[
'tabs'
]
logging
.
debug
(
'tabs = {0} {1}'
.
format
(
tabs
.
__class__
,
tabs
))
if
len
(
tabs
)
>
0
:
if
len
(
tabs
)
>
0
:
course
=
get_course_for_item
(
tabs
[
0
])
course
=
get_course_for_item
(
tabs
[
0
])
...
...
common/test/data/full/policies/6.002_Spring_2012.json
View file @
855c8bb7
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
{
"type"
:
"courseware"
},
{
"type"
:
"courseware"
},
{
"type"
:
"course_info"
,
"name"
:
"Course Info"
},
{
"type"
:
"course_info"
,
"name"
:
"Course Info"
},
{
"type"
:
"static_tab"
,
"url_slug"
:
"syllabus"
,
"name"
:
"Syllabus"
},
{
"type"
:
"static_tab"
,
"url_slug"
:
"syllabus"
,
"name"
:
"Syllabus"
},
{
"type"
:
"static_tab"
,
"url_slug"
:
"resources"
,
"name"
:
"Resources"
},
{
"type"
:
"discussion"
,
"name"
:
"Discussion"
},
{
"type"
:
"discussion"
,
"name"
:
"Discussion"
},
{
"type"
:
"wiki"
,
"name"
:
"Wiki"
},
{
"type"
:
"wiki"
,
"name"
:
"Wiki"
},
{
"type"
:
"progress"
,
"name"
:
"Progress"
}
{
"type"
:
"progress"
,
"name"
:
"Progress"
}
...
...
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