'Test courseware 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_courseware_page_unfulfilled_prereqs(self):

    pre_requisite_course = CourseFactory.create(org='edX', course='900', run='test_run')
    pre_requisite_courses = [unicode(pre_requisite_course.id)]
    course = CourseFactory.create(org='edX', course='1000', run='test_run', pre_requisite_courses=pre_requisite_courses)
    set_prerequisite_courses(course.id, pre_requisite_courses)
    test_password = 't3stp4ss.!'
    user = UserFactory.create()
    user.set_password(test_password)
    user.save()
    self.login(user.email, test_password)
    CourseEnrollmentFactory(user=user, course_id=course.id)
    url = reverse('courseware', args=[unicode(course.id)])
    response = self.client.get(url)
    self.assertRedirects(response, reverse('dashboard'))
    self.assertEqual(response.status_code, 302)
    fulfill_course_milestone(pre_requisite_course.id, user)
    response = self.client.get(url)
    self.assertEqual(response.status_code, 200)
