Merge pull request #21960 from edx/feanil/fix_more_cms_tests

Feanil/fix more cms tests
This commit is contained in:
Feanil Patel
2019-10-08 15:48:54 -04:00
committed by GitHub
8 changed files with 20 additions and 8 deletions

View File

@@ -16,13 +16,13 @@ def empty_asset_trashcan(course_locs):
thumbs = store.get_all_content_thumbnails_for_course(course_loc)
for thumb in thumbs:
print("Deleting {0}...".format(thumb))
store.delete(thumb['_id'])
store.delete(thumb['asset_key'])
# then delete all of the assets
assets, __ = store.get_all_content_for_course(course_loc)
for asset in assets:
print("Deleting {0}...".format(asset))
store.delete(asset['_id'])
store.delete(asset['asset_key'])
def restore_asset_from_trashcan(location):

View File

@@ -346,7 +346,7 @@ def copy_or_rename_transcript(new_name, old_name, item, delete_old=False, user=N
"""
filename = u'subs_{0}.srt.sjson'.format(old_name)
content_location = StaticContent.compute_location(item.location.course_key, filename)
transcripts = contentstore().find(content_location).data
transcripts = contentstore().find(content_location).data.decode('utf-8')
save_subs_to_store(json.loads(transcripts), new_name, item)
item.sub = new_name
item.save_with_metadata(user)