Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-data-api-client
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
OpenEdx
edx-analytics-data-api-client
Commits
582f7a36
Commit
582f7a36
authored
Apr 24, 2015
by
David Adams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests written.
parent
3a67edd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
6 deletions
+83
-6
analyticsclient/course.py
+2
-6
analyticsclient/tests/test_course.py
+81
-0
No files found.
analyticsclient/course.py
View file @
582f7a36
...
@@ -104,11 +104,9 @@ class Course(object):
...
@@ -104,11 +104,9 @@ class Course(object):
"""
"""
path
=
'courses/{0}/problems/'
.
format
(
self
.
course_id
)
path
=
'courses/{0}/problems/'
.
format
(
self
.
course_id
)
return
self
.
client
.
get
(
path
,
data_format
=
data_format
)
return
self
.
client
.
get
(
path
,
data_format
=
data_format
)
def
video_settings
(
self
,
data_format
=
DF
.
JSON
):
def
video_settings
(
self
,
data_format
=
DF
.
JSON
):
"""
""" Get the settings used by the pipeline to process the logs. """
Get the settings used by the pipeline to process the logs.
"""
path
=
'courses/{0}/videos/settings/'
.
format
(
self
.
course_id
)
path
=
'courses/{0}/videos/settings/'
.
format
(
self
.
course_id
)
return
self
.
client
.
get
(
path
,
data_format
=
data_format
)
return
self
.
client
.
get
(
path
,
data_format
=
data_format
)
...
@@ -159,8 +157,6 @@ class Course(object):
...
@@ -159,8 +157,6 @@ class Course(object):
if
querystring
:
if
querystring
:
path
+=
'?{0}'
.
format
(
querystring
)
path
+=
'?{0}'
.
format
(
querystring
)
return
self
.
client
.
get
(
path
,
data_format
=
data_format
)
return
self
.
client
.
get
(
path
,
data_format
=
data_format
)
def
on_campus_data
(
self
,
start_date
=
None
,
end_date
=
None
,
def
on_campus_data
(
self
,
start_date
=
None
,
end_date
=
None
,
...
...
analyticsclient/tests/test_course.py
View file @
582f7a36
...
@@ -147,3 +147,84 @@ class CoursesTests(ClientTestCase):
...
@@ -147,3 +147,84 @@ class CoursesTests(ClientTestCase):
uri
=
self
.
get_api_url
(
'courses/{0}/problems/'
.
format
(
self
.
course_id
))
uri
=
self
.
get_api_url
(
'courses/{0}/problems/'
.
format
(
self
.
course_id
))
httpretty
.
register_uri
(
httpretty
.
GET
,
uri
,
body
=
json
.
dumps
(
body
))
httpretty
.
register_uri
(
httpretty
.
GET
,
uri
,
body
=
json
.
dumps
(
body
))
self
.
assertEqual
(
body
,
self
.
course
.
problems
())
self
.
assertEqual
(
body
,
self
.
course
.
problems
())
@httpretty.activate
def
test_video_settings
(
self
):
body
=
[
{
'type'
:
'INTEGER'
,
'name'
:
'seek_interval'
,
'value'
:
'10'
,
}
]
uri
=
self
.
get_api_url
(
'courses/{0}/videos/settings/'
.
format
(
self
.
course_id
))
httpretty
.
register_uri
(
httpretty
.
GET
,
uri
,
body
=
json
.
dumps
(
body
),
)
self
.
assertEqual
(
body
,
self
.
course
.
video_settings
())
@httpretty.activate
def
test_videos
(
self
):
body
=
[
{
'video_id'
:
'i4x-DB-XML-video-vid-dtds_ids_and_idrefs'
,
'total_activity'
:
23
,
'unique_users'
:
1
,
},
]
date
=
'2015-01-01'
uri
=
self
.
get_api_url
(
'courses/{0}/videos/'
.
format
(
self
.
course_id
))
httpretty
.
register_uri
(
httpretty
.
GET
,
'{0}?start_date={1}&end_date={1}'
.
format
(
uri
,
date
),
body
=
json
.
dumps
(
body
),
)
self
.
assertEqual
(
body
,
self
.
course
.
videos
(
start_date
=
date
,
end_date
=
date
))
@httpretty.activate
def
test_video_seek_times
(
self
):
body
=
[
{
'seek_interval'
:
50
,
'total_activity'
:
1
,
'unique_daily_users'
:
1
},
]
date
=
'2015-01-01'
video_id
=
'i4x-DB-RD-video-vid-functional_dependencies-slice2'
uri
=
self
.
get_api_url
(
'courses/{0}/videos/{1}/seek_times/'
.
format
(
self
.
course_id
,
video_id
))
httpretty
.
register_uri
(
httpretty
.
GET
,
'{0}?video_id={1}&start_date={2}&end_date={2}'
.
format
(
uri
,
video_id
,
date
),
body
=
json
.
dumps
(
body
),
)
self
.
assertEqual
(
body
,
self
.
course
.
video_seek_times
(
video_id
=
video_id
,
start_date
=
date
,
end_date
=
date
))
@httpretty.activate
def
test_on_campus_data
(
self
):
body
=
[
{
'username'
:
'user_77'
,
'total_video_activity'
:
1
,
'unique_videos_watched'
:
1
,
'total_video_watch_time'
:
10
,
},
]
date
=
'2015-01-01'
uri
=
self
.
get_api_url
(
'courses/{0}/on_campus_student_data/'
.
format
(
self
.
course_id
))
httpretty
.
register_uri
(
httpretty
.
GET
,
'{0}?start_date={1}&end_date={1}'
.
format
(
uri
,
date
),
body
=
json
.
dumps
(
body
),
)
self
.
assertEqual
(
body
,
self
.
course
.
on_campus_data
(
start_date
=
date
,
end_date
=
date
))
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