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
6b3c5e7d
Commit
6b3c5e7d
authored
Feb 20, 2014
by
zubiar-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get updates_location from course_location directly + update tests
STUD-1248
parent
62a32cda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
cms/djangoapps/contentstore/views/course.py
+1
-6
cms/djangoapps/contentstore/views/tests/test_course_updates.py
+7
-2
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
6b3c5e7d
...
...
@@ -470,12 +470,7 @@ def course_info_update_handler(request, tag=None, package_id=None, branch=None,
course_location
=
loc_mapper
()
.
translate_locator_to_location
(
CourseLocator
(
package_id
=
package_id
),
get_course
=
True
)
# add location to loc_mapper
updates_locator
=
loc_mapper
()
.
translate_location
(
course_location
.
course_id
,
course_location
.
replace
(
category
=
'course_info'
,
name
=
'updates'
),
False
,
True
)
updates_location
=
loc_mapper
()
.
translate_locator_to_location
(
updates_locator
)
updates_location
=
course_location
.
replace
(
category
=
'course_info'
,
name
=
block
)
if
provided_id
==
''
:
provided_id
=
None
...
...
cms/djangoapps/contentstore/views/tests/test_course_updates.py
View file @
6b3c5e7d
...
...
@@ -150,7 +150,7 @@ class CourseUpdateTest(CourseTestCase):
def
test_post_course_update
(
self
):
"""
Test
posting a course update through api on a newly created course updates location map with course_updates
Test
that a user can successfully post on course updates 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'
])
...
...
@@ -174,7 +174,6 @@ class CourseUpdateTest(CourseTestCase):
package_id
=
course_location
.
course_id
.
replace
(
'/'
,
'.'
),
branch
=
branch
,
version_guid
=
version
,
block_id
=
block
)
# test that user can successfully post on course updates whose location in not added in loc_mapper
content
=
u"Sample update"
payload
=
{
'content'
:
content
,
'date'
:
'January 8, 2013'
}
course_update_url
=
updates_locator
.
url_reverse
(
'course_info_update'
)
...
...
@@ -185,3 +184,9 @@ class CourseUpdateTest(CourseTestCase):
payload
=
json
.
loads
(
resp
.
content
)
self
.
assertHTMLEqual
(
payload
[
'content'
],
content
)
# now test that calling translate_location returns a locator whose block_id is 'updates'
updates_location
=
course_location
.
replace
(
category
=
'course_info'
,
name
=
block
)
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
)
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