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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
15 deletions
+30
-15
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
+21
-14
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'
]
=
[]
...
...
@@ -259,7 +266,7 @@ def _parse_updates_html(html):
class
CourseContentList
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CourseContentList gets a collection of content for a given
course. You can use the **uri** value in
...
...
@@ -289,7 +296,7 @@ class CourseContentList(SecureAPIView):
**Response Values**
* category: The type of content.
* category: The type of content.
* due: The due date.
...
...
@@ -328,7 +335,7 @@ class CourseContentList(SecureAPIView):
class
CourseContentDetail
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CourseContentDetail returns a JSON collection for a specified
CourseContent entity. If the specified CourseContent is the Course, the
...
...
@@ -422,7 +429,7 @@ class CourseContentDetail(SecureAPIView):
class
CoursesList
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesList returns a collection of courses in the edX Platform. You can
use the uri value in the response to get details of the course.
...
...
@@ -464,7 +471,7 @@ class CoursesList(SecureAPIView):
class
CoursesDetail
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesDetail returns details for a course. You can use the uri values
in the resources collection in the response to get more course
...
...
@@ -506,7 +513,7 @@ class CoursesDetail(SecureAPIView):
* id: The unique identifier for the course.
* resources: A collection of URIs to use to get more information about
the course.
the course.
"""
def
get
(
self
,
request
,
course_id
):
...
...
@@ -556,7 +563,7 @@ class CoursesDetail(SecureAPIView):
class
CoursesGroupsList
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesGroupsList returns a collection of course group relationship
entities(?) for a specified course entity.
...
...
@@ -697,7 +704,7 @@ class CoursesGroupsDetail(SecureAPIView):
class
CoursesOverview
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesOverview returns an HTML representation of the overview for the
specified course. CoursesOverview has an optional parse parameter that
...
...
@@ -742,7 +749,7 @@ class CoursesOverview(SecureAPIView):
class
CoursesUpdates
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesUpdates returns an HTML representation of the overview for the
specified course. CoursesUpdates has an optional parse parameter that
...
...
@@ -785,7 +792,7 @@ class CoursesUpdates(SecureAPIView):
class
CoursesStaticTabsList
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesStaticTabsList returns a collection of custom pages in the
course. CoursesStaticTabsList has an optional detail parameter that when
...
...
@@ -837,10 +844,10 @@ class CoursesStaticTabsList(SecureAPIView):
class
CoursesStaticTabsDetail
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesStaticTabsDetail returns a collection of custom pages in the
course, including the page content.
course, including the page content.
**Example Requests**
...
...
@@ -881,7 +888,7 @@ class CoursesStaticTabsDetail(SecureAPIView):
class
CoursesUsersList
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesUsersList returns a collection of users enrolled or pre-enrolled
in the course.
...
...
@@ -979,7 +986,7 @@ class CoursesUsersList(SecureAPIView):
class
CoursesUsersDetail
(
SecureAPIView
):
"""
**Use Case**
**Use Case**
CoursesUsersDetail returns a details about a specified user of a 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