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
1b71ace4
Commit
1b71ace4
authored
Jul 02, 2014
by
Mat Peterson
Committed by
Diana Huang
Jul 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
studio new style assumption corrections
parent
e39cc5df
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
51 additions
and
50 deletions
+51
-50
cms/djangoapps/contentstore/tests/test_contentstore.py
+6
-7
cms/djangoapps/contentstore/views/tests/test_checklists.py
+3
-3
cms/djangoapps/contentstore/views/tests/test_course_index.py
+2
-2
cms/djangoapps/contentstore/views/tests/test_course_updates.py
+3
-2
cms/djangoapps/contentstore/views/tests/test_helpers.py
+3
-3
cms/djangoapps/contentstore/views/tests/test_import_export.py
+2
-2
cms/djangoapps/contentstore/views/tests/test_item.py
+1
-1
cms/djangoapps/contentstore/views/tests/test_preview.py
+1
-1
common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py
+30
-29
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
1b71ace4
...
...
@@ -311,7 +311,6 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
direct_store
=
self
.
store
_
,
course_items
=
import_from_xml
(
direct_store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
usage_key
=
course_items
[
0
]
.
id
.
make_usage_key
(
'vertical'
,
'vertical_test'
)
# also try a custom response which will trigger the 'is this course in whitelist' logic
resp
=
self
.
client
.
get_json
(
get_url
(
'xblock_view_handler'
,
usage_key
,
kwargs
=
{
'view_name'
:
'container_preview'
})
...
...
@@ -319,10 +318,10 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
self
.
assertEqual
(
resp
.
status_code
,
200
)
# These are the data-ids of the xblocks contained in the vertical.
self
.
assertContains
(
resp
,
'edX
+toy+2012_Fall+video+
sample_video'
)
self
.
assertContains
(
resp
,
'edX
+toy+2012_Fall+video+
separate_file_video'
)
self
.
assertContains
(
resp
,
'edX
+toy+2012_Fall+video+
video_with_end_time'
)
self
.
assertContains
(
resp
,
'edX
+toy+2012_Fall+poll_question+
T1_changemind_poll_foo_2'
)
self
.
assertContains
(
resp
,
'edX
/toy/video/
sample_video'
)
self
.
assertContains
(
resp
,
'edX
/toy/video/
separate_file_video'
)
self
.
assertContains
(
resp
,
'edX
/toy/video/
video_with_end_time'
)
self
.
assertContains
(
resp
,
'edX
/toy/poll_question/
T1_changemind_poll_foo_2'
)
def
test_delete
(
self
):
store
=
self
.
store
...
...
@@ -1217,7 +1216,7 @@ class ContentStoreTest(ContentStoreTestCase):
resp
=
self
.
_show_course_overview
(
course
.
id
)
self
.
assertContains
(
resp
,
'<article class="courseware-overview" data-locator="
location:MITx+999+Robot_Super_Course+course+Robot_Super_Course" data-course-key="slashes:MITx+999+
Robot_Super_Course">'
,
'<article class="courseware-overview" data-locator="
i4x://MITx/999/course/Robot_Super_Course" data-course-key="MITx/999/
Robot_Super_Course">'
,
status_code
=
200
,
html
=
True
)
...
...
@@ -1238,7 +1237,7 @@ class ContentStoreTest(ContentStoreTestCase):
data
=
parse_json
(
resp
)
self
.
assertRegexpMatches
(
data
[
'locator'
],
r"
location:MITx\+999\+Robot_Super_Course\+chapter\+
([0-9]|[a-f]){3,}$"
r"
MITx/999/chapter/
([0-9]|[a-f]){3,}$"
)
def
test_capa_module
(
self
):
...
...
cms/djangoapps/contentstore/views/tests/test_checklists.py
View file @
1b71ace4
...
...
@@ -43,7 +43,7 @@ class ChecklistTestCase(CourseTestCase):
response
=
self
.
client
.
get
(
self
.
checklists_url
)
self
.
assertContains
(
response
,
"Getting Started With Studio"
)
# Verify expansion of action URL happened.
self
.
assertContains
(
response
,
'course_team/
slashes:mitX+333+
Checklists_Course'
)
self
.
assertContains
(
response
,
'course_team/
mitX/333/
Checklists_Course'
)
# Verify persisted checklist does NOT have expanded URL.
checklist_0
=
self
.
get_persisted_checklists
()[
0
]
self
.
assertEqual
(
'ManageUsers'
,
get_action_url
(
checklist_0
,
0
))
...
...
@@ -136,8 +136,8 @@ class ChecklistTestCase(CourseTestCase):
# Verify no side effect in the original list.
self
.
assertEqual
(
get_action_url
(
checklist
,
index
),
stored
)
test_expansion
(
self
.
course
.
checklists
[
0
],
0
,
'ManageUsers'
,
'/course_team/
slashes:mitX+333+
Checklists_Course/'
)
test_expansion
(
self
.
course
.
checklists
[
1
],
1
,
'CourseOutline'
,
'/course/
slashes:mitX+333+
Checklists_Course'
)
test_expansion
(
self
.
course
.
checklists
[
0
],
0
,
'ManageUsers'
,
'/course_team/
mitX/333/
Checklists_Course/'
)
test_expansion
(
self
.
course
.
checklists
[
1
],
1
,
'CourseOutline'
,
'/course/
mitX/333/
Checklists_Course'
)
test_expansion
(
self
.
course
.
checklists
[
2
],
0
,
'http://help.edge.edx.org/'
,
'http://help.edge.edx.org/'
)
...
...
cms/djangoapps/contentstore/views/tests/test_course_index.py
View file @
1b71ace4
...
...
@@ -96,7 +96,7 @@ class TestCourseIndex(CourseTestCase):
# First spot check some values in the root response
self
.
assertEqual
(
json_response
[
'category'
],
'course'
)
self
.
assertEqual
(
json_response
[
'id'
],
'
location:MITx+999+Robot_Super_Course+course+
Robot_Super_Course'
)
self
.
assertEqual
(
json_response
[
'id'
],
'
i4x://MITx/999/course/
Robot_Super_Course'
)
self
.
assertEqual
(
json_response
[
'display_name'
],
'Robot Super Course'
)
self
.
assertTrue
(
json_response
[
'is_container'
])
self
.
assertFalse
(
json_response
[
'is_draft'
])
...
...
@@ -106,7 +106,7 @@ class TestCourseIndex(CourseTestCase):
self
.
assertTrue
(
len
(
children
)
>
0
)
first_child_response
=
children
[
0
]
self
.
assertEqual
(
first_child_response
[
'category'
],
'chapter'
)
self
.
assertEqual
(
first_child_response
[
'id'
],
'
location:MITx+999+Robot_Super_Course+chapter+
Week_1'
)
self
.
assertEqual
(
first_child_response
[
'id'
],
'
i4x://MITx/999/chapter/
Week_1'
)
self
.
assertEqual
(
first_child_response
[
'display_name'
],
'Week 1'
)
self
.
assertTrue
(
first_child_response
[
'is_container'
])
self
.
assertFalse
(
first_child_response
[
'is_draft'
])
...
...
cms/djangoapps/contentstore/views/tests/test_course_updates.py
View file @
1b71ace4
...
...
@@ -5,7 +5,8 @@ import json
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
,
reverse_usage_url
from
opaque_keys.edx.locations
import
Location
,
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.keys
import
UsageKey
from
xmodule.modulestore.django
import
modulestore
...
...
@@ -246,7 +247,7 @@ class CourseUpdateTest(CourseTestCase):
self
.
assertHTMLEqual
(
payload
[
'content'
],
content
)
updates_location
=
self
.
course
.
id
.
make_usage_key
(
'course_info'
,
'updates'
)
self
.
assertTrue
(
isinstance
(
updates_location
,
Location
))
self
.
assertTrue
(
isinstance
(
updates_location
,
UsageKey
))
self
.
assertEqual
(
updates_location
.
name
,
block
)
# check posting on handouts
...
...
cms/djangoapps/contentstore/views/tests/test_helpers.py
View file @
1b71ace4
...
...
@@ -15,7 +15,7 @@ class HelpersTestCase(CourseTestCase):
# Verify course URL
self
.
assertEqual
(
xblock_studio_url
(
self
.
course
),
u'/course/
slashes:MITx+999+
Robot_Super_Course'
)
u'/course/
MITx/999/
Robot_Super_Course'
)
# Verify chapter URL
chapter
=
ItemFactory
.
create
(
parent_location
=
self
.
course
.
location
,
category
=
'chapter'
,
...
...
@@ -31,13 +31,13 @@ class HelpersTestCase(CourseTestCase):
vertical
=
ItemFactory
.
create
(
parent_location
=
sequential
.
location
,
category
=
'vertical'
,
display_name
=
'Unit'
)
self
.
assertEqual
(
xblock_studio_url
(
vertical
),
u'/unit/
location:MITx+999+Robot_Super_Course+vertical+
Unit'
)
u'/unit/
i4x://MITx/999/vertical/
Unit'
)
# Verify child vertical URL
child_vertical
=
ItemFactory
.
create
(
parent_location
=
vertical
.
location
,
category
=
'vertical'
,
display_name
=
'Child Vertical'
)
self
.
assertEqual
(
xblock_studio_url
(
child_vertical
),
u'/container/
location:MITx+999+Robot_Super_Course+vertical+
Child_Vertical'
)
u'/container/
i4x://MITx/999/vertical/
Child_Vertical'
)
# Verify video URL
video
=
ItemFactory
.
create
(
parent_location
=
child_vertical
.
location
,
category
=
"video"
,
...
...
cms/djangoapps/contentstore/views/tests/test_import_export.py
View file @
1b71ace4
...
...
@@ -296,7 +296,7 @@ class ExportTestCase(CourseTestCase):
"""
fake_xblock
=
ItemFactory
.
create
(
parent_location
=
self
.
course
.
location
,
category
=
'aawefawef'
)
self
.
store
.
publish
(
fake_xblock
.
location
,
self
.
user
.
id
)
self
.
_verify_export_failure
(
u'/unit/
location:MITx+999+Robot_Super_Course+course+
Robot_Super_Course'
)
self
.
_verify_export_failure
(
u'/unit/
i4x://MITx/999/course/
Robot_Super_Course'
)
def
test_export_failure_subsection_level
(
self
):
"""
...
...
@@ -308,7 +308,7 @@ class ExportTestCase(CourseTestCase):
category
=
'aawefawef'
)
self
.
_verify_export_failure
(
u'/unit/
location:MITx+999+Robot_Super_Course+vertical+
foo'
)
self
.
_verify_export_failure
(
u'/unit/
i4x://MITx/999/vertical/
foo'
)
def
_verify_export_failure
(
self
,
expectedText
):
""" Export failure helper method. """
...
...
cms/djangoapps/contentstore/views/tests/test_item.py
View file @
1b71ace4
...
...
@@ -158,7 +158,7 @@ class GetItem(ItemTest):
html
,
# The instance of the wrapper class will have an auto-generated ID. Allow any
# characters after wrapper.
(
r'"/container/
location:MITx\+999\+Robot_Super_Course\+wrapper\+
\w+" class="action-button">\s*'
(
r'"/container/
i4x://MITx/999/wrapper/
\w+" class="action-button">\s*'
'<span class="action-button-text">View</span>'
)
)
...
...
cms/djangoapps/contentstore/views/tests/test_preview.py
View file @
1b71ace4
...
...
@@ -43,6 +43,6 @@ class GetPreviewHtmlTestCase(TestCase):
# Verify student view html is returned, and the usage ID is as expected.
self
.
assertRegexpMatches
(
html
,
'data-usage-id="
location:MITx
\
+999
\
+Robot_Super_Course
\
+html
\
+
html_[0-9]*"'
'data-usage-id="
i4x://MITx/999/html/
html_[0-9]*"'
)
self
.
assertRegexpMatches
(
html
,
'<html>foobar</html>'
)
common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py
View file @
1b71ace4
...
...
@@ -40,33 +40,34 @@ def check_has_course_method(modulestore, locator, locator_key_fields):
assert_true
(
modulestore
.
has_course
(
locator
,
ignore_case
))
for
key_field
in
locator_key_fields
:
locator_changes_that_should_not_be_found
=
[
# pylint: disable=invalid-name
# replace value for one of the keys
{
key_field
:
'fake'
},
# add a character at the end
{
key_field
:
getattr
(
locator
,
key_field
)
+
'X'
},
# add a character in the beginning
{
key_field
:
'X'
+
getattr
(
locator
,
key_field
)},
]
for
changes
in
locator_changes_that_should_not_be_found
:
search_locator
=
locator
.
replace
(
**
changes
)
assert_false
(
modulestore
.
has_course
(
search_locator
),
error_message
.
format
(
search_locator
,
ignore_case
)
)
if
getattr
(
locator
,
key_field
):
locator_changes_that_should_not_be_found
=
[
# pylint: disable=invalid-name
# replace value for one of the keys
{
key_field
:
'fake'
},
# add a character at the end
{
key_field
:
getattr
(
locator
,
key_field
)
+
'X'
},
# add a character in the beginning
{
key_field
:
'X'
+
getattr
(
locator
,
key_field
)},
]
for
changes
in
locator_changes_that_should_not_be_found
:
search_locator
=
locator
.
replace
(
**
changes
)
assert_false
(
modulestore
.
has_course
(
search_locator
),
error_message
.
format
(
search_locator
,
ignore_case
)
)
# test case [in]sensitivity
locator_case_changes
=
[
{
key_field
:
getattr
(
locator
,
key_field
)
.
upper
()},
{
key_field
:
getattr
(
locator
,
key_field
)
.
capitalize
()},
{
key_field
:
getattr
(
locator
,
key_field
)
.
capitalize
()
.
swapcase
()},
]
for
changes
in
locator_case_changes
:
search_locator
=
locator
.
replace
(
**
changes
)
# if ignore_case is true, the course would be found with a different-cased course locator.
# if ignore_case is false, the course should NOT found given an incorrectly-cased locator.
assert_equals
(
modulestore
.
has_course
(
search_locator
,
ignore_case
)
is
not
None
,
ignore_case
,
error_message
.
format
(
search_locator
,
ignore_case
)
)
# test case [in]sensitivity
locator_case_changes
=
[
{
key_field
:
getattr
(
locator
,
key_field
)
.
upper
()},
{
key_field
:
getattr
(
locator
,
key_field
)
.
capitalize
()},
{
key_field
:
getattr
(
locator
,
key_field
)
.
capitalize
()
.
swapcase
()},
]
for
changes
in
locator_case_changes
:
search_locator
=
locator
.
replace
(
**
changes
)
# if ignore_case is true, the course would be found with a different-cased course locator.
# if ignore_case is false, the course should NOT found given an incorrectly-cased locator.
assert_equals
(
modulestore
.
has_course
(
search_locator
,
ignore_case
)
is
not
None
,
ignore_case
,
error_message
.
format
(
search_locator
,
ignore_case
)
)
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