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
c17cb38c
Commit
c17cb38c
authored
Mar 04, 2014
by
zubiar-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add location of handouts in loc_mapper
STUD-1248
parent
b4478081
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
18 deletions
+24
-18
cms/djangoapps/contentstore/views/item.py
+6
-0
cms/djangoapps/contentstore/views/tests/test_course_updates.py
+18
-1
common/test/acceptance/fixtures/course.py
+0
-17
No files found.
cms/djangoapps/contentstore/views/item.py
View file @
c17cb38c
...
...
@@ -127,6 +127,12 @@ def xblock_handler(request, tag=None, package_id=None, branch=None, version_guid
return
_delete_item_at_location
(
old_location
,
delete_children
,
delete_all_versions
,
request
.
user
)
else
:
# Since we have a package_id, we are updating an existing xblock.
if
block
==
'handouts'
and
old_location
is
None
:
# update handouts location in loc_mapper
course_location
=
loc_mapper
()
.
translate_locator_to_location
(
locator
,
get_course
=
True
)
old_location
=
course_location
.
replace
(
category
=
'course_info'
,
name
=
block
)
locator
=
loc_mapper
()
.
translate_location
(
course_location
.
course_id
,
old_location
)
return
_save_item
(
request
,
locator
,
...
...
cms/djangoapps/contentstore/views/tests/test_course_updates.py
View file @
c17cb38c
...
...
@@ -230,7 +230,8 @@ class CourseUpdateTest(CourseTestCase):
def
test_post_course_update
(
self
):
"""
Test that a user can successfully post on course updates of a course whose location in not in loc_mapper
Test that a user can successfully post on course updates and handouts of a course
whose location in not in loc_mapper
"""
# create a course via the view handler
course_location
=
Location
([
'i4x'
,
'Org_1'
,
'Course_1'
,
'course'
,
'Run_1'
])
...
...
@@ -270,3 +271,19 @@ class CourseUpdateTest(CourseTestCase):
updates_locator
=
loc_mapper
()
.
translate_location
(
course_location
.
course_id
,
updates_location
)
self
.
assertTrue
(
isinstance
(
updates_locator
,
BlockUsageLocator
))
self
.
assertEqual
(
updates_locator
.
block_id
,
block
)
# check posting on handouts
block
=
u'handouts'
handouts_locator
=
BlockUsageLocator
(
package_id
=
updates_locator
.
package_id
,
branch
=
updates_locator
.
branch
,
version_guid
=
version
,
block_id
=
block
)
course_handouts_url
=
handouts_locator
.
url_reverse
(
'xblock'
)
content
=
u"Sample handout"
payload
=
{
"data"
:
content
}
resp
=
self
.
client
.
ajax_post
(
course_handouts_url
,
payload
)
# check that response status is 200 not 500
self
.
assertEqual
(
resp
.
status_code
,
200
)
payload
=
json
.
loads
(
resp
.
content
)
self
.
assertHTMLEqual
(
payload
[
'data'
],
content
)
common/test/acceptance/fixtures/course.py
View file @
c17cb38c
...
...
@@ -224,9 +224,6 @@ class CourseFixture(StudioApiFixture):
"""
self
.
_create_course
()
# Remove once STUD-1248 is resolved
self
.
_update_loc_map
()
self
.
_install_course_updates
()
self
.
_install_course_handouts
()
self
.
_configure_course
()
...
...
@@ -362,20 +359,6 @@ class CourseFixture(StudioApiFixture):
"Could not add update to course: {0}. Status was {1}"
.
format
(
update
,
response
.
status_code
))
def
_update_loc_map
(
self
):
"""
Force update of the location map.
"""
# We perform a GET request to force Studio to update the course location map.
# This is a (minor) bug in the Studio RESTful API: STUD-1248
url
=
"{base}/course_info/{course}"
.
format
(
base
=
STUDIO_BASE_URL
,
course
=
self
.
_course_loc
)
response
=
self
.
session
.
get
(
url
,
headers
=
{
'Accept'
:
'text/html'
})
if
not
response
.
ok
:
raise
CourseFixtureError
(
"Could not load Studio dashboard to trigger location map update. Status was {0}"
.
format
(
response
.
status_code
))
def
_create_xblock_children
(
self
,
parent_loc
,
xblock_descriptions
):
"""
Recursively create XBlock children.
...
...
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