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
14e0387b
Commit
14e0387b
authored
Mar 22, 2013
by
Christina Roberts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1716 from MITx/bug/orphan
Bug/orphan
parents
4d266fa3
e7727fcc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
cms/djangoapps/contentstore/tests/test_course_updates.py
+19
-9
No files found.
cms/djangoapps/contentstore/tests/test_course_updates.py
View file @
14e0387b
'''unit tests for course_info views and models.'''
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
django.core.urlresolvers
import
reverse
import
json
from
webob.exc
import
HTTPServerError
from
django.http
import
HttpResponseBadRequest
class
CourseUpdateTest
(
CourseTestCase
):
'''The do all and end all of unit test cases.'''
def
test_course_update
(
self
):
'''Go through each interface and ensure it works.'''
# first get the update to force the creation
url
=
reverse
(
'course_info'
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
...
...
@@ -18,9 +19,10 @@ class CourseUpdateTest(CourseTestCase):
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'
:
''
})
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"
)
...
...
@@ -90,14 +92,22 @@ class CourseUpdateTest(CourseTestCase):
'course'
:
self
.
course_location
.
course
,
'provided_id'
:
''
})
resp
=
self
.
client
.
post
(
url
,
json
.
dumps
(
payload
),
"application/json"
)
payload
=
json
.
loads
(
resp
.
content
)
self
.
assertContains
(
self
.
client
.
post
(
url
,
json
.
dumps
(
payload
),
"application/json"
),
'<garbage'
)
# set to valid html which would break an xml parser
content
=
"<p><br><br></p>"
payload
=
{
'content'
:
content
,
'date'
:
'January 11, 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
(
content
,
json
.
loads
(
resp
.
content
)[
'content'
])
# now try to delete a non-existent update
url
=
reverse
(
'course_info_json'
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
'course'
:
self
.
course_location
.
course
,
...
...
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