'Test that cohort-schemed user partitions are ignored in the
grades export.'

def test_cohort_scheme_partition(self):

    cohort_scheme_partition = UserPartition(0, 'Cohort-schemed    Group    Configuration', 'Group    Configuration    based    on    Cohorts', [Group(0, 'Group    A'), Group(1, 'Group    B')], scheme_id='cohort')
    experiment_group_a = Group(2, u'Exp\xe9riment    Group    A')
    experiment_group_b = Group(3, u'Exp\xe9riment    Group    B')
    experiment_partition = UserPartition(1, u'Content    Exp\xe9riment    Configuration', u'Group    Configuration    for    Content    Exp\xe9riments', [experiment_group_a, experiment_group_b], scheme_id='random')
    course = CourseFactory.create(cohort_config={'cohorted': True}, user_partitions=[cohort_scheme_partition, experiment_partition])
    user_a = UserFactory.create(username='user_a')
    user_b = UserFactory.create(username='user_b')
    CourseEnrollment.enroll(user_a, course.id)
    CourseEnrollment.enroll(user_b, course.id)
    course_tag_api.set_course_tag(user_a, course.id, RandomUserPartitionScheme.key_for_partition(experiment_partition), experiment_group_a.id)
    course_tag_api.set_course_tag(user_b, course.id, RandomUserPartitionScheme.key_for_partition(experiment_partition), experiment_group_b.id)
    cohort_a = CohortFactory.create(course_id=course.id, name=u'Coh\xf8rt    A', users=[user_a])
    CourseUserGroupPartitionGroup(course_user_group=cohort_a, partition_id=cohort_scheme_partition.id, group_id=cohort_scheme_partition.groups[0].id).save()
    experiment_group_message = u'Experiment    Group    ({content_experiment})'
    self._verify_cell_data_for_user(user_a.username, course.id, experiment_group_message.format(content_experiment=experiment_partition.name), experiment_group_a.name)
    self._verify_cell_data_for_user(user_b.username, course.id, experiment_group_message.format(content_experiment=experiment_partition.name), experiment_group_b.name)
    cohort_name_header = 'Cohort    Name'
    self._verify_cell_data_for_user(user_a.username, course.id, cohort_name_header, cohort_a.name)
    self._verify_cell_data_for_user(user_b.username, course.id, cohort_name_header, u'')
