def test_instructor_paced_discussion_module_visibility(self):
        """
        Verify that discussion modules scheduled for release in the future are
        not visible to students in an instructor-paced course.
        """
        course, section = self.setup_course(start=self.now, self_paced=False)
        self.create_discussion_modules(section)

        # Only the released module should be visible when the course is instructor-paced.
        modules = get_accessible_discussion_modules(course, self.non_staff_user)
        self.assertTrue(
            all(module.display_name == 'released' for module in modules)
        )
    def test_self_paced_discussion_module_visibility(self):
        """
        Regression test. Verify that discussion modules scheduled for release
        in the future are visible to students in a self-paced course.
        """
        course, section = self.setup_course(start=self.now, self_paced=True)
        self.create_discussion_modules(section)

        # The scheduled module should be visible when the course is self-paced.
        modules = get_accessible_discussion_modules(course, self.non_staff_user)
        self.assertEqual(len(modules), 2)
        self.assertTrue(
            any(module.display_name == 'scheduled' for module in modules)
        )