本文整理汇总了Python中contentstore.views.course.GroupConfiguration.get_or_create_content_group方法的典型用法代码示例。如果您正苦于以下问题:Python GroupConfiguration.get_or_create_content_group方法的具体用法?Python GroupConfiguration.get_or_create_content_group怎么用?Python GroupConfiguration.get_or_create_content_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类contentstore.views.course.GroupConfiguration
的用法示例。
在下文中一共展示了GroupConfiguration.get_or_create_content_group方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_content_group_not_used
# 需要导入模块: from contentstore.views.course import GroupConfiguration [as 别名]
# 或者: from contentstore.views.course.GroupConfiguration import get_or_create_content_group [as 别名]
def test_content_group_not_used(self):
"""
Test that right data structure will be created if content group is not used.
"""
self._add_user_partitions(scheme_id='cohort')
actual = GroupConfiguration.get_or_create_content_group(self.store, self.course)
expected = self._get_expected_content_group(usage_for_group=[])
self.assertEqual(actual, expected)
示例2: test_can_get_correct_usage_info_for_content_groups
# 需要导入模块: from contentstore.views.course import GroupConfiguration [as 别名]
# 或者: from contentstore.views.course.GroupConfiguration import get_or_create_content_group [as 别名]
def test_can_get_correct_usage_info_for_content_groups(self):
"""
Test if content group json updated successfully with usage information.
"""
self._add_user_partitions(count=1, scheme_id='cohort')
vertical, __ = self._create_problem_with_content_group(cid=0, group_id=1, name_suffix='0')
actual = GroupConfiguration.get_or_create_content_group(self.store, self.course)
expected = self._get_expected_content_group(usage_for_group=[
{
'url': '/container/{}'.format(vertical.location),
'label': 'Test Unit 0 / Test Problem 0'
}
])
self.assertEqual(actual, expected)
示例3: test_can_use_one_content_group_in_multiple_problems
# 需要导入模块: from contentstore.views.course import GroupConfiguration [as 别名]
# 或者: from contentstore.views.course.GroupConfiguration import get_or_create_content_group [as 别名]
def test_can_use_one_content_group_in_multiple_problems(self):
"""
Test if multiple problems are present in usage info when they use same
content group.
"""
self._add_user_partitions(scheme_id='cohort')
vertical, __ = self._create_problem_with_content_group(cid=0, group_id=1, name_suffix='0')
vertical1, __ = self._create_problem_with_content_group(cid=0, group_id=1, name_suffix='1')
actual = GroupConfiguration.get_or_create_content_group(self.store, self.course)
expected = self._get_expected_content_group(usage_for_group=[
{
'url': '/container/{}'.format(vertical.location),
'label': 'Test Unit 0 / Test Problem 0'
},
{
'url': '/container/{}'.format(vertical1.location),
'label': 'Test Unit 1 / Test Problem 1'
}
])
self.assertEqual(actual, expected)