clear request cache after celery task finishes (TNL-2705)

set max_num_courses_in_cache on modulestore
This commit is contained in:
Adam Palay
2016-05-16 11:45:59 -04:00
parent 3e747c379f
commit a7d638de9e
6 changed files with 89 additions and 29 deletions

View File

@@ -88,7 +88,7 @@ class HelperMethods(object):
self.save_course()
return (vertical, split_test)
def _create_problem_with_content_group(self, cid, group_id, name_suffix='', special_characters=''):
def _create_problem_with_content_group(self, cid, group_id, name_suffix='', special_characters='', orphan=False):
"""
Create a problem
Assign content group to the problem.
@@ -112,7 +112,8 @@ class HelperMethods(object):
data={'metadata': group_access_content}
)
self.course.children.append(vertical.location)
if not orphan:
self.course.children.append(vertical.location)
self.save_course()
return vertical, problem
@@ -682,24 +683,16 @@ class GroupConfigurationsUsageInfoTestCase(CourseTestCase, HelperMethods):
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_can_get_correct_usage_info_with_orphan(self, module_store_type):
"""
Test if content group json updated successfully with usage information even if there is
an orphan in content group.
Test if content group json updated successfully with usage information
even if there is an orphan in content group.
"""
self.course = CourseFactory.create(default_store=module_store_type)
self._add_user_partitions(count=1, scheme_id='cohort')
vertical, problem = self._create_problem_with_content_group(cid=0, group_id=1, name_suffix='0')
vertical, __ = self._create_problem_with_content_group(cid=0, group_id=1, name_suffix='0', orphan=True)
# Assert that there is no orphan in the course yet.
self.assertEqual(len(self.store.get_orphans(self.course.id)), 0)
# Update problem(created earlier) to an orphan.
with self.store.branch_setting(ModuleStoreEnum.Branch.published_only):
vertical = self.store.get_item(vertical.location)
vertical.children.remove(problem.location)
self.store.update_item(vertical, self.user.id)
# Assert that the problem is orphan now.
self.assertIn(problem.location, self.store.get_orphans(self.course.id))
# Assert that there is an orphan in the course, and that it's the vertical
self.assertEqual(len(self.store.get_orphans(self.course.id)), 1)
self.assertIn(vertical.location, self.store.get_orphans(self.course.id))
# Get the expected content group information based on module store.
if module_store_type == ModuleStoreEnum.Type.mongo: