Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-val
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-val
Commits
84482730
Commit
84482730
authored
Sep 08, 2017
by
Mushtaq Ali
Committed by
GitHub
Sep 08, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #93 from edx/remove-transcript-preferences
Remove transcript preferences
parents
5f62dbe1
d126a663
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
edxval/api.py
+14
-0
edxval/tests/test_api.py
+28
-0
No files found.
edxval/api.py
View file @
84482730
...
...
@@ -266,6 +266,20 @@ def create_or_update_transcript_preferences(course_id, **preferences):
return
TranscriptPreferenceSerializer
(
transcript_preference
)
.
data
def
remove_transcript_preferences
(
course_id
):
"""
Deletes course-wide transcript preferences.
Arguments:
course_id(str): course id
"""
try
:
transcript_preference
=
TranscriptPreference
.
objects
.
get
(
course_id
=
course_id
)
transcript_preference
.
delete
()
except
TranscriptPreference
.
DoesNotExist
:
pass
def
get_course_video_image_url
(
course_id
,
edx_video_id
):
"""
Returns course video image url or None if no image found
...
...
edxval/tests/test_api.py
View file @
84482730
...
...
@@ -1731,6 +1731,34 @@ class TranscriptPreferencesTest(TestCase):
transcript_preferences
=
api
.
get_transcript_preferences
(
self
.
course_id
)
self
.
assert_prefs
(
transcript_preferences
,
cielo24_prefs
)
def
test_remove_transcript_preferences
(
self
):
"""
Verify that `remove_transcript_preferences` api method works as expected.
"""
# Verify that transcript preferences exist.
transcript_preferences
=
api
.
get_transcript_preferences
(
self
.
course_id
)
self
.
assertIsNotNone
(
transcript_preferences
)
# Remove course wide transcript preferences.
api
.
remove_transcript_preferences
(
self
.
course_id
)
# Verify now transcript preferences no longer exist.
transcript_preferences
=
api
.
get_transcript_preferences
(
self
.
course_id
)
self
.
assertIsNone
(
transcript_preferences
)
def
test_remove_transcript_preferences_not_found
(
self
):
"""
Verify that `remove_transcript_preferences` api method works as expected when no record is found.
"""
course_id
=
'dummy-course-id'
# Verify that transcript preferences do not exist.
transcript_preferences
=
api
.
get_transcript_preferences
(
course_id
)
self
.
assertIsNone
(
transcript_preferences
)
# Verify that calling `remove_transcript_preferences` does not break the code.
api
.
remove_transcript_preferences
(
course_id
)
def
test_update_transcript_preferences
(
self
):
"""
Verify that `create_or_update_transcript_preferences` api function updates as expected
...
...
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