learningequality/ka-lite — pull request #422 by bcipolli (2013-08-07 22:00:19+00:00)
Title: Videoscan caching bug

This is dependent on #329, and solves issues #293 and #295 (@jamalex indeed, these were separate issues!).

Background:
* We readily cache topic, exercise, and video pages to increase performance. However, when videos are downloaded or deleted, we have to update all relevant cached files, to show that the new videos are available.

Current changes:
* videoscan had a bug for deletion case--the list of videos was updated in the database first, which updated the queryset. The queryset was iterated over to find files to delete, and since those videofile objects were gone from the queryset, nothing got updated!
* the cache deletion/invalidation code was not being called in the api call from video_download.html, which deletes the videos. Now I make that call directly from the function in main/api_views.py
* We didn't have sufficient test coverage for these cases. I added tests to cover each of the two scenarios above.