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
27d32f19
Commit
27d32f19
authored
Jul 30, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test reproducing the error: malformed course_update silently failing update
parent
77a796e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
cms/djangoapps/contentstore/tests/test_course_updates.py
+34
-0
No files found.
cms/djangoapps/contentstore/tests/test_course_updates.py
View file @
27d32f19
...
...
@@ -2,6 +2,7 @@
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
django.core.urlresolvers
import
reverse
import
json
from
xmodule.modulestore.django
import
modulestore
class
CourseUpdateTest
(
CourseTestCase
):
...
...
@@ -145,3 +146,36 @@ class CourseUpdateTest(CourseTestCase):
resp
=
self
.
client
.
delete
(
url
)
payload
=
json
.
loads
(
resp
.
content
)
self
.
assertTrue
(
len
(
payload
)
==
before_delete
-
1
)
def
test_no_ol_course_update
(
self
):
'''Test trying to add to a saved course_update which is not an ol.'''
# get the updates and set to something wrong
location
=
self
.
course
.
location
.
replace
(
category
=
'course_info'
,
name
=
'updates'
)
modulestore
(
'direct'
)
.
create_and_save_xmodule
(
location
)
course_updates
=
modulestore
(
'direct'
)
.
get_item
(
location
)
course_updates
.
data
=
'bad news'
modulestore
(
'direct'
)
.
update_item
(
location
,
course_updates
.
data
)
init_content
=
'<iframe width="560" height="315" src="http://www.youtube.com/embed/RocY-Jd93XU" frameborder="0">'
content
=
init_content
+
'</iframe>'
payload
=
{
'content'
:
content
,
'date'
:
'January 8, 2013'
}
url
=
reverse
(
'course_info_json'
,
kwargs
=
{
'org'
:
self
.
course
.
location
.
org
,
'course'
:
self
.
course
.
location
.
course
,
'provided_id'
:
''
})
resp
=
self
.
client
.
post
(
url
,
json
.
dumps
(
payload
),
"application/json"
)
payload
=
json
.
loads
(
resp
.
content
)
self
.
assertHTMLEqual
(
payload
[
'content'
],
content
)
# now confirm that the bad news and the iframe make up 2 updates
url
=
reverse
(
'course_info_json'
,
kwargs
=
{
'org'
:
self
.
course
.
location
.
org
,
'course'
:
self
.
course
.
location
.
course
,
'provided_id'
:
''
})
resp
=
self
.
client
.
get
(
url
)
payload
=
json
.
loads
(
resp
.
content
)
self
.
assertTrue
(
len
(
payload
)
==
2
)
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