'Tests course student have right access to content w/o preview.'

def test_student_has_access(self):

    course_key = self.course.id
    chapter = ItemFactory.create(category='chapter', parent_location=self.course.location)
    overview = CourseOverview.get_from_id(course_key)
    CourseEnrollmentFactory(user=self.student, course_id=self.course.id)
    modules = [self.course, overview, chapter]
    with patch('courseware.access.in_preview_mode') as mock_preview:
        mock_preview.return_value = False
        for obj in modules:
            self.assertTrue(bool(access.has_access(self.student, 'load', obj, course_key=self.course.id)))
    with patch('courseware.access.in_preview_mode') as mock_preview:
        mock_preview.return_value = True
        for obj in modules:
            self.assertFalse(bool(access.has_access(self.student, 'load', obj, course_key=self.course.id)))
