def _get_staff_lock_from(xblock): """ Returns a string representation of the section or subsection that sets the xblock's release date """ source = find_staff_lock_source(xblock) return _xblock_type_and_display_name(source) if source else None
def test_no_source_for_vertical(self): """Tests a vertical with no staff lock set anywhere""" self._update_staff_locks(False, False, False) self.assertIsNone(utils.find_staff_lock_source(self.vertical))
def test_orphan_has_no_source(self): """Tests that a orphaned xblock has no staff lock source""" self.assertIsNone(utils.find_staff_lock_source(self.orphan))
def _verify_staff_lock_source(self, item, expected_source): """Helper to verify that the staff lock source of a given item matches the expected source""" source = utils.find_staff_lock_source(item) self.assertEqual(source.location, expected_source.location) self.assertTrue(source.visible_to_staff_only)