def _test_visible_to_students(self, expected_visible_without_lock, name, start_date, publish=False): """ Helper method that checks that is_xblock_visible_to_students returns the correct value both with and without visible_to_staff_only set. """ no_staff_lock = self._create_xblock_with_start_date(name, start_date, publish, visible_to_staff_only=False) self.assertEqual(expected_visible_without_lock, utils.is_xblock_visible_to_students(no_staff_lock)) # any xblock with visible_to_staff_only set to True should not be visible to students. staff_lock = self._create_xblock_with_start_date( name + "_locked", start_date, publish, visible_to_staff_only=True ) self.assertFalse(utils.is_xblock_visible_to_students(staff_lock))
def test_draft_released_xblock(self): """Verifies that a xblock with an unreleased draft and a released published version is visible""" vertical = self._create_xblock_with_start_date('draft_released', self.past, publish=True) # Create an unreleased draft version of the xblock vertical.start = self.future modulestore().update_item(vertical, self.dummy_user) self.assertTrue(utils.is_xblock_visible_to_students(vertical))
def test_public_no_start_xblock(self): """Verifies that a public (published) xblock with no start date is visible""" vertical = self._create_xblock_with_start_date('public_no_start', None, publish=True) self.assertTrue(utils.is_xblock_visible_to_students(vertical))
def test_private_no_start_xblock(self): """Verifies that a private xblock with no start date is not visible""" vertical = self._create_xblock_with_start_date('private_no_start', None) self.assertFalse(utils.is_xblock_visible_to_students(vertical))
def test_public_released_xblock(self): """Verifies that public (published) released xblock is visible""" vertical = self._create_xblock_with_start_date('public_released', self.past, publish=True) self.assertTrue(utils.is_xblock_visible_to_students(vertical))
def test_public_unreleased_xblock(self): """Verifies that a public (published) unreleased xblock is not visible""" vertical = self._create_xblock_with_start_date('public_unreleased', self.future, publish=True) self.assertFalse(utils.is_xblock_visible_to_students(vertical))
def test_private_released_xblock(self): """Verifies that a private released xblock is not visible""" vertical = self._create_xblock_with_start_date('private_released', self.past) self.assertFalse(utils.is_xblock_visible_to_students(vertical))