示例#1
0
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
示例#2
0
 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))
示例#3
0
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
示例#4
0
 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))
示例#5
0
 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)
示例#6
0
 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))
示例#7
0
 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))
示例#8
0
 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)