'Make sure cohorts.get_cohort() returns None if no group is already
assigned to a user instead of assigning/creating a group automatically'

def test_get_cohort_with_assign(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')
    config_course_cohorts(course, is_cohorted=True, auto_cohorts=['AutoGroup'])
    self.assertIsNone(cohorts.get_cohort(user, course.id, assign=False))
    self.assertEquals(cohorts.get_cohort(user, course.id).name, 'AutoGroup')
