'The view should respond with HTTP 409 if the user has an existing active enrollment for the course.'

def test_existing_active_enrollment(self):

    CourseEnrollment.enroll(self.user, self.course.id)
    self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course.id))
    response = self._post_to_view()
    self.assertEqual(response.status_code, 409)
    msg = Messages.ENROLLMENT_EXISTS.format(username=self.user.username, course_id=self.course.id)
    self.assertResponseMessage(response, msg)
