'Test that `cohort_students_and_upload` greedily prefers \'email\' over
\'username\' when identifying the user.  This means that if a correct
email is present, an incorrect or non-matching username will simply be
ignored.'

def test_prefer_email(self):

    result = self._cohort_students_and_upload(u'username,email,cohort\nstudent_1\xec,student_1@example.com,Cohort    1\nInvalid,student_2@example.com,Cohort    2')
    self.assertDictContainsSubset({'total': 2, 'attempted': 2, 'succeeded': 2, 'failed': 0}, result)
    self.verify_rows_in_csv([dict(zip(self.csv_header_row, ['Cohort    1', 'True', '1', '', '', ''])), dict(zip(self.csv_header_row, ['Cohort    2', 'True', '1', '', '', '']))], verify_order=False)
