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
e92280ac
Commit
e92280ac
authored
Jun 17, 2014
by
Chris Dodge
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tunnel through any attributes needed for the overview API
remove duplicate data
parent
66985ff9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletions
+16
-1
lms/djangoapps/api_manager/courses/content.py
+3
-0
lms/djangoapps/api_manager/courses/tests.py
+6
-1
lms/djangoapps/api_manager/courses/views.py
+7
-0
No files found.
lms/djangoapps/api_manager/courses/content.py
View file @
e92280ac
...
...
@@ -107,5 +107,8 @@ TEST_COURSE_OVERVIEW_CONTENT = dedent(
<section class="faq">
<p>Some text here</p>
</section>
<section class="intro-video" data-videoid="foobar">
</section>
"""
)
lms/djangoapps/api_manager/courses/tests.py
View file @
e92280ac
...
...
@@ -548,11 +548,12 @@ class CoursesApiTests(TestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertGreater
(
len
(
response
.
data
),
0
)
sections
=
response
.
data
[
'sections'
]
self
.
assertEqual
(
len
(
sections
),
4
)
self
.
assertEqual
(
len
(
sections
),
5
)
self
.
assertIsNotNone
(
self
.
_find_item_by_class
(
sections
,
'about'
))
self
.
assertIsNotNone
(
self
.
_find_item_by_class
(
sections
,
'prerequisites'
))
self
.
assertIsNotNone
(
self
.
_find_item_by_class
(
sections
,
'course-staff'
))
self
.
assertIsNotNone
(
self
.
_find_item_by_class
(
sections
,
'faq'
))
self
.
assertIsNotNone
(
self
.
_find_item_by_class
(
sections
,
'intro-video'
))
course_staff
=
self
.
_find_item_by_class
(
sections
,
'course-staff'
)
staff
=
course_staff
[
'articles'
]
...
...
@@ -578,6 +579,10 @@ class CoursesApiTests(TestCase):
invalid_tab
=
self
.
_find_item_by_class
(
sections
,
'invalid_tab'
)
self
.
assertFalse
(
invalid_tab
)
intro_video
=
self
.
_find_item_by_class
(
sections
,
'intro-video'
)
self
.
assertEqual
(
len
(
intro_video
[
'attributes'
]),
1
)
self
.
assertEqual
(
intro_video
[
'attributes'
][
'data-videoid'
],
'foobar'
)
def
test_courses_overview_get_invalid_course
(
self
):
#try a bogus course_id to test failure case
test_uri
=
'{}/{}/overview'
.
format
(
self
.
base_courses_uri
,
self
.
test_bogus_course_id
)
...
...
lms/djangoapps/api_manager/courses/views.py
View file @
e92280ac
...
...
@@ -173,6 +173,13 @@ def _parse_overview_html(html):
section_data
=
OrderedDict
()
section_data
[
'class'
]
=
section_class
section_data
[
'attributes'
]
=
{}
for
attribute_key
in
section
.
keys
():
# don't return the class attribute as we are already using the class attribute
# as a key name to the result set, so we don't want to end up duplicating it
if
attribute_key
!=
'class'
:
section_data
[
'attributes'
][
attribute_key
]
=
section
.
get
(
attribute_key
)
articles
=
section
.
findall
(
'article'
)
if
articles
:
section_data
[
'articles'
]
=
[]
...
...
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