'With the right API key, update an existing enrollment with a new mode.'

def test_update_enrollment_with_mode(self):

    for mode in [CourseMode.DEFAULT_MODE_SLUG, CourseMode.VERIFIED]:
        CourseModeFactory.create(course_id=self.course.id, mode_slug=mode, mode_display_name=mode)
    self.assert_enrollment_status(as_server=True)
    self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course.id))
    (course_mode, is_active) = CourseEnrollment.enrollment_mode_for_user(self.user, self.course.id)
    self.assertTrue(is_active)
    self.assertEqual(course_mode, CourseMode.DEFAULT_MODE_SLUG)
    self.assert_enrollment_status(as_server=True, mode=CourseMode.VERIFIED, expected_status=status.HTTP_200_OK)
    (course_mode, is_active) = CourseEnrollment.enrollment_mode_for_user(self.user, self.course.id)
    self.assertTrue(is_active)
    self.assertEqual(course_mode, CourseMode.VERIFIED)
