'Make sure cohorts.get_cohort() does the right thing when the course is cohorted'

def test_get_cohort(self):

    course = modulestore().get_course(self.toy_course_key)
    self.assertEqual(course.id, self.toy_course_key)
    self.assertFalse(cohorts.is_course_cohorted(course.id))
    user = UserFactory(username='test', email='a@b.com')
    other_user = UserFactory(username='test2', email='a2@b.com')
    self.assertIsNone(cohorts.get_cohort(user, course.id), 'No    cohort    created    yet')
    cohort = CohortFactory(course_id=course.id, name='TestCohort', users=[user])
    self.assertIsNone(cohorts.get_cohort(user, course.id), "Course    isn't    cohorted,    so    shouldn't    have    a    cohort")
    config_course_cohorts(course, is_cohorted=True)
    self.assertEquals(cohorts.get_cohort(user, course.id).id, cohort.id, 'user    should    be    assigned    to    the    correct    cohort')
    self.assertEquals(cohorts.get_cohort(other_user, course.id).id, cohorts.get_cohort_by_name(course.id, cohorts.DEFAULT_COHORT_NAME).id, 'other_user    should    be    assigned    to    the    default    cohort')
