'Test course access when a course has pre-requisite course yet to be completed'

@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PREREQUISITE_COURSES': True, 'MILESTONES_APP': True})
def test_access_on_course_with_pre_requisites(self):

    user = UserFactory.create()
    pre_requisite_course = CourseFactory.create(org='test_org', number='788', run='test_run')
    pre_requisite_courses = [unicode(pre_requisite_course.id)]
    course = CourseFactory.create(org='test_org', number='786', run='test_run', pre_requisite_courses=pre_requisite_courses)
    set_prerequisite_courses(course.id, pre_requisite_courses)
    CourseEnrollmentFactory(user=user, course_id=course.id)
    response = access._has_access_course(user, 'load', course)
    self.assertFalse(response)
    self.assertIsInstance(response, access_response.MilestoneAccessError)
    staff = StaffFactory.create(course_key=course.id)
    self.assertTrue(access._has_access_course(staff, 'load', course))
    fulfill_course_milestone(pre_requisite_course.id, user)
    self.assertTrue(access._has_access_course(user, 'load', course))
