Commit 63bc8c96 by Julia Hansbrough

Merge pull request #1771 from edx/flowerhack/fix/lms-1526

Update mode appropriately when user enrolls
parents c023797b e4ebb586
......@@ -825,7 +825,7 @@ class CourseEnrollment(models.Model):
verified the user authentication and access.
"""
enrollment = cls.get_or_create_enrollment(user, course_id)
enrollment.update_enrollment(is_active=True)
enrollment.update_enrollment(is_active=True, mode=mode)
return enrollment
@classmethod
......
......@@ -342,6 +342,14 @@ class EnrollInCourseTest(TestCase):
)
self.assertFalse(enrollment_record.is_active)
# Make sure mode is updated properly if user unenrolls & re-enrolls
enrollment = CourseEnrollment.enroll(user, course_id, "verified")
self.assertEquals(enrollment.mode, "verified")
CourseEnrollment.unenroll(user, course_id)
enrollment = CourseEnrollment.enroll(user, course_id, "audit")
self.assertTrue(CourseEnrollment.is_enrolled(user, course_id))
self.assertEquals(enrollment.mode, "audit")
def assert_no_events_were_emitted(self):
"""Ensures no events were emitted since the last event related assertion"""
self.assertFalse(self.mock_server_track.called)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment