'Make sure that cohorts.get_cohort_id() correctly returns the cohort id, or raises a ValueError when given an
invalid course key.'

def test_get_cohort_id(self):

    course = modulestore().get_course(self.toy_course_key)
    self.assertFalse(cohorts.is_course_cohorted(course.id))
    user = UserFactory(username='test', email='a@b.com')
    self.assertIsNone(cohorts.get_cohort_id(user, course.id))
    config_course_cohorts(course, is_cohorted=True)
    cohort = CohortFactory(course_id=course.id, name='TestCohort', users=[user])
    self.assertEqual(cohorts.get_cohort_id(user, course.id), cohort.id)
    self.assertRaises(Http404, (lambda : cohorts.get_cohort_id(user, CourseLocator('course', 'does_not', 'exist'))))
