'Test enrolling using a username as the identifier.'

def test_enroll_with_username(self):

    response = self.request_bulk_enroll({'identifiers': self.notenrolled_student.username, 'action': 'enroll', 'email_students': False, 'courses': self.course_key})
    self.assertEqual(response.status_code, 200)
    expected = {'action': 'enroll', 'auto_enroll': False, 'email_students': False, 'courses': {self.course_key: {'action': 'enroll', 'auto_enroll': False, 'results': [{'identifier': self.notenrolled_student.username, 'before': {'enrollment': False, 'auto_enroll': False, 'user': True, 'allowed': False}, 'after': {'enrollment': True, 'auto_enroll': False, 'user': True, 'allowed': False}}]}}}
    manual_enrollments = ManualEnrollmentAudit.objects.all()
    self.assertEqual(manual_enrollments.count(), 1)
    self.assertEqual(manual_enrollments[0].state_transition, UNENROLLED_TO_ENROLLED)
    res_json = json.loads(response.content)
    self.assertEqual(res_json, expected)
