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
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
21 deletions
+22
-21
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
+1
-0
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
1b71ace4
...
@@ -311,7 +311,6 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
...
@@ -311,7 +311,6 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
direct_store
=
self
.
store
direct_store
=
self
.
store
_
,
course_items
=
import_from_xml
(
direct_store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
_
,
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'
)
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
# also try a custom response which will trigger the 'is this course in whitelist' logic
resp
=
self
.
client
.
get_json
(
resp
=
self
.
client
.
get_json
(
get_url
(
'xblock_view_handler'
,
usage_key
,
kwargs
=
{
'view_name'
:
'container_preview'
})
get_url
(
'xblock_view_handler'
,
usage_key
,
kwargs
=
{
'view_name'
:
'container_preview'
})
...
@@ -319,10 +318,10 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
...
@@ -319,10 +318,10 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
# These are the data-ids of the xblocks contained in the vertical.
# 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/video/
sample_video'
)
self
.
assertContains
(
resp
,
'edX
+toy+2012_Fall+video+
separate_file_video'
)
self
.
assertContains
(
resp
,
'edX
/toy/video/
separate_file_video'
)
self
.
assertContains
(
resp
,
'edX
+toy+2012_Fall+video+
video_with_end_time'
)
self
.
assertContains
(
resp
,
'edX
/toy/video/
video_with_end_time'
)
self
.
assertContains
(
resp
,
'edX
+toy+2012_Fall+poll_question+
T1_changemind_poll_foo_2'
)
self
.
assertContains
(
resp
,
'edX
/toy/poll_question/
T1_changemind_poll_foo_2'
)
def
test_delete
(
self
):
def
test_delete
(
self
):
store
=
self
.
store
store
=
self
.
store
...
@@ -1217,7 +1216,7 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1217,7 +1216,7 @@ class ContentStoreTest(ContentStoreTestCase):
resp
=
self
.
_show_course_overview
(
course
.
id
)
resp
=
self
.
_show_course_overview
(
course
.
id
)
self
.
assertContains
(
self
.
assertContains
(
resp
,
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
,
status_code
=
200
,
html
=
True
html
=
True
)
)
...
@@ -1238,7 +1237,7 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1238,7 +1237,7 @@ class ContentStoreTest(ContentStoreTestCase):
data
=
parse_json
(
resp
)
data
=
parse_json
(
resp
)
self
.
assertRegexpMatches
(
self
.
assertRegexpMatches
(
data
[
'locator'
],
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
):
def
test_capa_module
(
self
):
...
...
cms/djangoapps/contentstore/views/tests/test_checklists.py
View file @
1b71ace4
...
@@ -43,7 +43,7 @@ class ChecklistTestCase(CourseTestCase):
...
@@ -43,7 +43,7 @@ class ChecklistTestCase(CourseTestCase):
response
=
self
.
client
.
get
(
self
.
checklists_url
)
response
=
self
.
client
.
get
(
self
.
checklists_url
)
self
.
assertContains
(
response
,
"Getting Started With Studio"
)
self
.
assertContains
(
response
,
"Getting Started With Studio"
)
# Verify expansion of action URL happened.
# 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.
# Verify persisted checklist does NOT have expanded URL.
checklist_0
=
self
.
get_persisted_checklists
()[
0
]
checklist_0
=
self
.
get_persisted_checklists
()[
0
]
self
.
assertEqual
(
'ManageUsers'
,
get_action_url
(
checklist_0
,
0
))
self
.
assertEqual
(
'ManageUsers'
,
get_action_url
(
checklist_0
,
0
))
...
@@ -136,8 +136,8 @@ class ChecklistTestCase(CourseTestCase):
...
@@ -136,8 +136,8 @@ class ChecklistTestCase(CourseTestCase):
# Verify no side effect in the original list.
# Verify no side effect in the original list.
self
.
assertEqual
(
get_action_url
(
checklist
,
index
),
stored
)
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
[
0
],
0
,
'ManageUsers'
,
'/course_team/
mitX/333/
Checklists_Course/'
)
test_expansion
(
self
.
course
.
checklists
[
1
],
1
,
'CourseOutline'
,
'/course/
slashes: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/'
)
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):
...
@@ -96,7 +96,7 @@ class TestCourseIndex(CourseTestCase):
# First spot check some values in the root response
# First spot check some values in the root response
self
.
assertEqual
(
json_response
[
'category'
],
'course'
)
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
.
assertEqual
(
json_response
[
'display_name'
],
'Robot Super Course'
)
self
.
assertTrue
(
json_response
[
'is_container'
])
self
.
assertTrue
(
json_response
[
'is_container'
])
self
.
assertFalse
(
json_response
[
'is_draft'
])
self
.
assertFalse
(
json_response
[
'is_draft'
])
...
@@ -106,7 +106,7 @@ class TestCourseIndex(CourseTestCase):
...
@@ -106,7 +106,7 @@ class TestCourseIndex(CourseTestCase):
self
.
assertTrue
(
len
(
children
)
>
0
)
self
.
assertTrue
(
len
(
children
)
>
0
)
first_child_response
=
children
[
0
]
first_child_response
=
children
[
0
]
self
.
assertEqual
(
first_child_response
[
'category'
],
'chapter'
)
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
.
assertEqual
(
first_child_response
[
'display_name'
],
'Week 1'
)
self
.
assertTrue
(
first_child_response
[
'is_container'
])
self
.
assertTrue
(
first_child_response
[
'is_container'
])
self
.
assertFalse
(
first_child_response
[
'is_draft'
])
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
...
@@ -5,7 +5,8 @@ import json
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
,
reverse_usage_url
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
from
xmodule.modulestore.django
import
modulestore
...
@@ -246,7 +247,7 @@ class CourseUpdateTest(CourseTestCase):
...
@@ -246,7 +247,7 @@ class CourseUpdateTest(CourseTestCase):
self
.
assertHTMLEqual
(
payload
[
'content'
],
content
)
self
.
assertHTMLEqual
(
payload
[
'content'
],
content
)
updates_location
=
self
.
course
.
id
.
make_usage_key
(
'course_info'
,
'updates'
)
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
)
self
.
assertEqual
(
updates_location
.
name
,
block
)
# check posting on handouts
# check posting on handouts
...
...
cms/djangoapps/contentstore/views/tests/test_helpers.py
View file @
1b71ace4
...
@@ -15,7 +15,7 @@ class HelpersTestCase(CourseTestCase):
...
@@ -15,7 +15,7 @@ class HelpersTestCase(CourseTestCase):
# Verify course URL
# Verify course URL
self
.
assertEqual
(
xblock_studio_url
(
self
.
course
),
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
# Verify chapter URL
chapter
=
ItemFactory
.
create
(
parent_location
=
self
.
course
.
location
,
category
=
'chapter'
,
chapter
=
ItemFactory
.
create
(
parent_location
=
self
.
course
.
location
,
category
=
'chapter'
,
...
@@ -31,13 +31,13 @@ class HelpersTestCase(CourseTestCase):
...
@@ -31,13 +31,13 @@ class HelpersTestCase(CourseTestCase):
vertical
=
ItemFactory
.
create
(
parent_location
=
sequential
.
location
,
category
=
'vertical'
,
vertical
=
ItemFactory
.
create
(
parent_location
=
sequential
.
location
,
category
=
'vertical'
,
display_name
=
'Unit'
)
display_name
=
'Unit'
)
self
.
assertEqual
(
xblock_studio_url
(
vertical
),
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
# Verify child vertical URL
child_vertical
=
ItemFactory
.
create
(
parent_location
=
vertical
.
location
,
category
=
'vertical'
,
child_vertical
=
ItemFactory
.
create
(
parent_location
=
vertical
.
location
,
category
=
'vertical'
,
display_name
=
'Child Vertical'
)
display_name
=
'Child Vertical'
)
self
.
assertEqual
(
xblock_studio_url
(
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
# Verify video URL
video
=
ItemFactory
.
create
(
parent_location
=
child_vertical
.
location
,
category
=
"video"
,
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):
...
@@ -296,7 +296,7 @@ class ExportTestCase(CourseTestCase):
"""
"""
fake_xblock
=
ItemFactory
.
create
(
parent_location
=
self
.
course
.
location
,
category
=
'aawefawef'
)
fake_xblock
=
ItemFactory
.
create
(
parent_location
=
self
.
course
.
location
,
category
=
'aawefawef'
)
self
.
store
.
publish
(
fake_xblock
.
location
,
self
.
user
.
id
)
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
):
def
test_export_failure_subsection_level
(
self
):
"""
"""
...
@@ -308,7 +308,7 @@ class ExportTestCase(CourseTestCase):
...
@@ -308,7 +308,7 @@ class ExportTestCase(CourseTestCase):
category
=
'aawefawef'
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
):
def
_verify_export_failure
(
self
,
expectedText
):
""" Export failure helper method. """
""" Export failure helper method. """
...
...
cms/djangoapps/contentstore/views/tests/test_item.py
View file @
1b71ace4
...
@@ -158,7 +158,7 @@ class GetItem(ItemTest):
...
@@ -158,7 +158,7 @@ class GetItem(ItemTest):
html
,
html
,
# The instance of the wrapper class will have an auto-generated ID. Allow any
# The instance of the wrapper class will have an auto-generated ID. Allow any
# characters after wrapper.
# 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>'
)
'<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):
...
@@ -43,6 +43,6 @@ class GetPreviewHtmlTestCase(TestCase):
# Verify student view html is returned, and the usage ID is as expected.
# Verify student view html is returned, and the usage ID is as expected.
self
.
assertRegexpMatches
(
self
.
assertRegexpMatches
(
html
,
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>'
)
self
.
assertRegexpMatches
(
html
,
'<html>foobar</html>'
)
common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py
View file @
1b71ace4
...
@@ -40,6 +40,7 @@ def check_has_course_method(modulestore, locator, locator_key_fields):
...
@@ -40,6 +40,7 @@ def check_has_course_method(modulestore, locator, locator_key_fields):
assert_true
(
modulestore
.
has_course
(
locator
,
ignore_case
))
assert_true
(
modulestore
.
has_course
(
locator
,
ignore_case
))
for
key_field
in
locator_key_fields
:
for
key_field
in
locator_key_fields
:
if
getattr
(
locator
,
key_field
):
locator_changes_that_should_not_be_found
=
[
# pylint: disable=invalid-name
locator_changes_that_should_not_be_found
=
[
# pylint: disable=invalid-name
# replace value for one of the keys
# replace value for one of the keys
{
key_field
:
'fake'
},
{
key_field
:
'fake'
},
...
...
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