Cherry pick the test-cleanup parts of e2826cb.

- look up test courses by id, not name
This commit is contained in:
Victor Shnayder
2012-11-19 15:23:05 -05:00
parent 4f359ea594
commit 5bf39fef96
4 changed files with 33 additions and 28 deletions

View File

@@ -339,6 +339,12 @@ class ModuleStore(object):
'''
raise NotImplementedError
def get_course(self, course_id):
'''
Look for a specific course id. Returns the course descriptor, or None if not found.
'''
raise NotImplementedError
def get_parent_locations(self, location):
'''Find all locations that are the parents of this location. Needed
for path_to_location().
@@ -399,3 +405,10 @@ class ModuleStoreBase(ModuleStore):
errorlog = self._get_errorlog(location)
return errorlog.errors
def get_course(self, course_id):
"""Default impl--linear search through course list"""
for c in self.get_courses():
if c.id == course_id:
return c
return None