'Test that the CohortPartitionScheme returns the correct group for a
student in a cohort when the cohort link is created / moved / deleted.'

def test_cohort_partition_group_assignment(self):

    test_cohort = CohortFactory(course_id=self.course_key)
    add_user_to_cohort(test_cohort, self.student.username)
    self.assert_student_in_group(None)
    link_cohort_to_partition_group(test_cohort, self.user_partition.id, self.groups[0].id)
    self.assert_student_in_group(self.groups[0])
    unlink_cohort_partition_group(test_cohort)
    link_cohort_to_partition_group(test_cohort, self.user_partition.id, self.groups[1].id)
    self.assert_student_in_group(self.groups[1])
    unlink_cohort_partition_group(test_cohort)
    self.assert_student_in_group(None)
