Commit c7e51647 by Greg Price Committed by Zia Fazal

Remove dead code

parent 04440137
...@@ -277,13 +277,6 @@ def add_cohort(course_key, name): ...@@ -277,13 +277,6 @@ def add_cohort(course_key, name):
) )
class CohortConflict(Exception):
"""
Raised when user to be added is already in another cohort in same course.
"""
pass
def add_user_to_cohort(cohort, username_or_email): def add_user_to_cohort(cohort, username_or_email):
""" """
Look up the given user, and if successful, add them to the specified cohort. Look up the given user, and if successful, add them to the specified cohort.
......
...@@ -408,34 +408,3 @@ class TestCohorts(django.test.TestCase): ...@@ -408,34 +408,3 @@ class TestCohorts(django.test.TestCase):
User.DoesNotExist, User.DoesNotExist,
lambda: cohorts.add_user_to_cohort(first_cohort, "non_existent_username") lambda: cohorts.add_user_to_cohort(first_cohort, "non_existent_username")
) )
def test_delete_empty_cohort(self):
"""
Make sure that cohorts.delete_empty_cohort() properly removes an empty cohort
for a given course.
"""
course = modulestore().get_course(self.toy_course_key)
user = UserFactory(username="Username", email="a@b.com")
empty_cohort = CohortFactory(course_id=course.id, name="EmptyCohort")
nonempty_cohort = CohortFactory(course_id=course.id, name="NonemptyCohort")
nonempty_cohort.users.add(user)
cohorts.delete_empty_cohort(course.id, "EmptyCohort")
# Make sure we cannot access the deleted cohort
self.assertRaises(
CourseUserGroup.DoesNotExist,
lambda: cohorts.get_cohort_by_id(course.id, empty_cohort.id)
)
self.assertRaises(
ValueError,
lambda: cohorts.delete_empty_cohort(course.id, "NonemptyCohort")
)
self.assertRaises(
CourseUserGroup.DoesNotExist,
lambda: cohorts.delete_empty_cohort(SlashSeparatedCourseKey('course', 'does_not', 'exist'), "EmptyCohort")
)
self.assertRaises(
CourseUserGroup.DoesNotExist,
lambda: cohorts.delete_empty_cohort(course.id, "NonExistentCohort")
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment