コード例 #1
0
 def _create_block_record_list(self, blocks, user_id=None):
     """
     Creates and returns a BlockRecordList for the given blocks.
     """
     block_record_list = BlockRecordList.from_list(blocks, self.course_key)
     return VisibleBlocks.cached_get_or_create(user_id or self.user_id,
                                               block_record_list)
コード例 #2
0
ファイル: test_models.py プロジェクト: svnh/edx-platform
 def test_blocks_property(self):
     """
     Ensures that, given an array of BlockRecord, creating visible_blocks
     and accessing visible_blocks.blocks yields a copy of the initial array.
     Also, trying to set the blocks property should raise an exception.
     """
     expected_blocks = BlockRecordList.from_list([self.record_a, self.record_b], self.course_key)
     visible_blocks = self._create_block_record_list(expected_blocks)
     self.assertEqual(expected_blocks, visible_blocks.blocks)
     with self.assertRaises(AttributeError):
         visible_blocks.blocks = expected_blocks
コード例 #3
0
ファイル: test_models.py プロジェクト: svnh/edx-platform
 def _create_block_record_list(self, blocks):
     """
     Creates and returns a BlockRecordList for the given blocks.
     """
     return VisibleBlocks.objects.create_from_blockrecords(BlockRecordList.from_list(blocks, self.course_key))
コード例 #4
0
ファイル: test_models.py プロジェクト: xy3657/edx-platform
 def _create_block_record_list(self, blocks):
     """
     Creates and returns a BlockRecordList for the given blocks.
     """
     return VisibleBlocks.cached_get_or_create(
         BlockRecordList.from_list(blocks, self.course_key))
コード例 #5
0
ファイル: test_models.py プロジェクト: jolyonb/edx-platform
 def _create_block_record_list(self, blocks, user_id=None):
     """
     Creates and returns a BlockRecordList for the given blocks.
     """
     block_record_list = BlockRecordList.from_list(blocks, self.course_key)
     return VisibleBlocks.cached_get_or_create(user_id or self.user_id, block_record_list)
コード例 #6
0
ファイル: test_models.py プロジェクト: dehamzah/edx-platform
 def _create_block_record_list(self, blocks):
     """
     Creates and returns a BlockRecordList for the given blocks.
     """
     return VisibleBlocks.cached_get_or_create(BlockRecordList.from_list(blocks, self.course_key))