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
8760e766
Commit
8760e766
authored
Jan 09, 2013
by
chrisndodge
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1244 from MITx/bug/dhm/jan13
Bug 107: create update not working
parents
21f5c2d8
62a70170
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
cms/djangoapps/contentstore/tests/test_course_updates.py
+8
-7
cms/djangoapps/contentstore/views.py
+5
-0
No files found.
cms/djangoapps/contentstore/tests/test_course_updates.py
View file @
8760e766
from
cms.djangoapps.contentstore.tests.test_course_settings
import
CourseTestCase
from
cms.djangoapps.contentstore.tests.test_course_settings
import
CourseTestCase
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
import
json
import
json
from
cms.djangoapps.contentstore.course_info_model
import
update_course_updates
class
CourseUpdateTest
(
CourseTestCase
):
class
CourseUpdateTest
(
CourseTestCase
):
def
test_course_update
(
self
):
def
test_course_update
(
self
):
...
@@ -14,14 +12,17 @@ class CourseUpdateTest(CourseTestCase):
...
@@ -14,14 +12,17 @@ class CourseUpdateTest(CourseTestCase):
content
=
'<iframe width="560" height="315" src="http://www.youtube.com/embed/RocY-Jd93XU" frameborder="0"></iframe>'
content
=
'<iframe width="560" height="315" src="http://www.youtube.com/embed/RocY-Jd93XU" frameborder="0"></iframe>'
payload
=
{
'content'
:
content
,
payload
=
{
'content'
:
content
,
'date'
:
'January 8, 2013'
}
'date'
:
'January 8, 2013'
}
# No means to post w/ provided_id missing. django doesn't handle. So, go direct for the create
payload
=
update_course_updates
([
'i4x'
,
self
.
course_location
.
org
,
self
.
course_location
.
course
,
'course_info'
,
"updates"
]
,
payload
)
url
=
reverse
(
'course_info'
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
'course'
:
self
.
course_location
.
course
,
url
=
reverse
(
'course_info'
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
'course'
:
self
.
course_location
.
course
,
'provided_id'
:
payload
[
'id'
]})
'provided_id'
:
''
})
resp
=
self
.
client
.
post
(
url
,
json
.
dumps
(
payload
),
"application/json"
)
payload
=
json
.
loads
(
resp
.
content
)
self
.
assertHTMLEqual
(
content
,
payload
[
'content'
],
"single iframe"
)
self
.
assertHTMLEqual
(
content
,
payload
[
'content'
],
"single iframe"
)
url
=
reverse
(
'course_info'
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
'course'
:
self
.
course_location
.
course
,
'provided_id'
:
payload
[
'id'
]})
content
+=
'<div>div <p>p</p></div>'
content
+=
'<div>div <p>p</p></div>'
payload
[
'content'
]
=
content
payload
[
'content'
]
=
content
resp
=
self
.
client
.
post
(
url
,
json
.
dumps
(
payload
),
"application/json"
)
resp
=
self
.
client
.
post
(
url
,
json
.
dumps
(
payload
),
"application/json"
)
...
...
cms/djangoapps/contentstore/views.py
View file @
8760e766
...
@@ -973,6 +973,11 @@ def course_info_updates(request, org, course, provided_id=None):
...
@@ -973,6 +973,11 @@ def course_info_updates(request, org, course, provided_id=None):
# ??? No way to check for access permission afaik
# ??? No way to check for access permission afaik
# get current updates
# get current updates
location
=
[
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
]
location
=
[
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
]
# Hmmm, provided_id is coming as empty string on create whereas I believe it used to be None :-(
# Possibly due to my removing the seemingly redundant pattern in urls.py
if
provided_id
==
''
:
provided_id
=
None
# check that logged in user has permissions to this item
# check that logged in user has permissions to this item
if
not
has_access
(
request
.
user
,
location
):
if
not
has_access
(
request
.
user
,
location
):
...
...
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