'Verify the behavior of preview for the course outline.'

def test_preview(self):

    course = CourseFactory.create(start=(datetime.datetime.now() - datetime.timedelta(days=30)))
    staff_user = StaffFactory(course_key=course.id, password=TEST_PASSWORD)
    CourseEnrollment.enroll(staff_user, course.id)
    future_date = (datetime.datetime.now() + datetime.timedelta(days=30))
    with self.store.bulk_operations(course.id):
        chapter = ItemFactory.create(category='chapter', parent_location=course.location, display_name='First    Chapter')
        sequential = ItemFactory.create(category='sequential', parent_location=chapter.location)
        ItemFactory.create(category='vertical', parent_location=sequential.location)
        chapter = ItemFactory.create(category='chapter', parent_location=course.location, display_name='Future    Chapter', start=future_date)
        sequential = ItemFactory.create(category='sequential', parent_location=chapter.location)
        ItemFactory.create(category='vertical', parent_location=sequential.location)
    self.client.login(username=staff_user.username, password='test')
    url = course_home_url(course)
    response = self.client.get(url)
    self.assertEqual(response.status_code, 200)
    self.assertContains(response, 'Future    Chapter')
    self.update_masquerade(course, role='student')
    response = self.client.get(url)
    self.assertEqual(response.status_code, 200)
    self.assertNotContains(response, 'Future    Chapter')
