本文整理汇总了Python中contentstore.views.course.GroupConfiguration.get_split_test_partitions_with_usage方法的典型用法代码示例。如果您正苦于以下问题:Python GroupConfiguration.get_split_test_partitions_with_usage方法的具体用法?Python GroupConfiguration.get_split_test_partitions_with_usage怎么用?Python GroupConfiguration.get_split_test_partitions_with_usage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类contentstore.views.course.GroupConfiguration
的用法示例。
在下文中一共展示了GroupConfiguration.get_split_test_partitions_with_usage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_can_use_one_configuration_in_multiple_experiments
# 需要导入模块: from contentstore.views.course import GroupConfiguration [as 别名]
# 或者: from contentstore.views.course.GroupConfiguration import get_split_test_partitions_with_usage [as 别名]
def test_can_use_one_configuration_in_multiple_experiments(self):
"""
Test if multiple experiments are present in usage info when they use same
group configuration.
"""
self._add_user_partitions()
vertical, __ = self._create_content_experiment(cid=0, name_suffix='0')
vertical1, __ = self._create_content_experiment(cid=0, name_suffix='1')
actual = GroupConfiguration.get_split_test_partitions_with_usage(self.course, self.store)
expected = [{
'id': 0,
'name': 'Name 0',
'scheme': 'random',
'description': 'Description 0',
'version': UserPartition.VERSION,
'groups': [
{'id': 0, 'name': 'Group A', 'version': 1},
{'id': 1, 'name': 'Group B', 'version': 1},
{'id': 2, 'name': 'Group C', 'version': 1},
],
'usage': [{
'url': '/container/{}'.format(vertical.location),
'label': 'Test Unit 0 / Test Content Experiment 0',
'validation': None,
}, {
'url': '/container/{}'.format(vertical1.location),
'label': 'Test Unit 1 / Test Content Experiment 1',
'validation': None,
}],
}]
self.assertEqual(actual, expected)
示例2: test_can_get_usage_info_when_special_characters_are_used
# 需要导入模块: from contentstore.views.course import GroupConfiguration [as 别名]
# 或者: from contentstore.views.course.GroupConfiguration import get_split_test_partitions_with_usage [as 别名]
def test_can_get_usage_info_when_special_characters_are_used(self):
"""
Test if group configurations json updated successfully when special
characters are being used in content experiment
"""
self._add_user_partitions(count=1)
vertical, __ = self._create_content_experiment(cid=0, name_suffix='0', special_characters=u"JOSÉ ANDRÉS")
actual = GroupConfiguration.get_split_test_partitions_with_usage(self.course, self.store)
expected = [{
'id': 0,
'name': 'Name 0',
'scheme': 'random',
'description': 'Description 0',
'version': UserPartition.VERSION,
'groups': [
{'id': 0, 'name': 'Group A', 'version': 1},
{'id': 1, 'name': 'Group B', 'version': 1},
{'id': 2, 'name': 'Group C', 'version': 1},
],
'usage': [{
'url': '/container/{}'.format(vertical.location),
'label': u"Test Unit 0 / Test Content Experiment 0JOSÉ ANDRÉS",
'validation': None,
}],
}]
self.assertEqual(actual, expected)
示例3: verify_validation_add_usage_info
# 需要导入模块: from contentstore.views.course import GroupConfiguration [as 别名]
# 或者: from contentstore.views.course.GroupConfiguration import get_split_test_partitions_with_usage [as 别名]
def verify_validation_add_usage_info(self, expected_result, mocked_message, mocked_validation_messages):
"""
Helper method for testing validation information present after add_usage_info.
"""
self._add_user_partitions()
split_test = self._create_content_experiment(cid=0, name_suffix='0')[1]
validation = StudioValidation(split_test.location)
validation.add(mocked_message)
mocked_validation_messages.return_value = validation
group_configuration = GroupConfiguration.get_split_test_partitions_with_usage(self.course, self.store)[0]
self.assertEqual(expected_result.to_json(), group_configuration['usage'][0]['validation'])
示例4: test_group_configuration_not_used
# 需要导入模块: from contentstore.views.course import GroupConfiguration [as 别名]
# 或者: from contentstore.views.course.GroupConfiguration import get_split_test_partitions_with_usage [as 别名]
def test_group_configuration_not_used(self):
"""
Test that right data structure will be created if group configuration is not used.
"""
self._add_user_partitions()
actual = GroupConfiguration.get_split_test_partitions_with_usage(self.course, self.store)
expected = [{
'id': 0,
'name': 'Name 0',
'scheme': 'random',
'description': 'Description 0',
'version': UserPartition.VERSION,
'groups': [
{'id': 0, 'name': 'Group A', 'version': 1},
{'id': 1, 'name': 'Group B', 'version': 1},
{'id': 2, 'name': 'Group C', 'version': 1},
],
'usage': [],
}]
self.assertEqual(actual, expected)
示例5: test_can_get_correct_usage_info
# 需要导入模块: from contentstore.views.course import GroupConfiguration [as 别名]
# 或者: from contentstore.views.course.GroupConfiguration import get_split_test_partitions_with_usage [as 别名]
def test_can_get_correct_usage_info(self):
"""
Test if group configurations json updated successfully with usage information.
"""
self._add_user_partitions(count=2)
vertical, __ = self._create_content_experiment(cid=0, name_suffix='0')
self._create_content_experiment(name_suffix='1')
actual = GroupConfiguration.get_split_test_partitions_with_usage(self.course, self.store)
expected = [{
'id': 0,
'name': 'Name 0',
'scheme': 'random',
'description': 'Description 0',
'version': UserPartition.VERSION,
'groups': [
{'id': 0, 'name': 'Group A', 'version': 1},
{'id': 1, 'name': 'Group B', 'version': 1},
{'id': 2, 'name': 'Group C', 'version': 1},
],
'usage': [{
'url': '/container/{}'.format(vertical.location),
'label': 'Test Unit 0 / Test Content Experiment 0',
'validation': None,
}],
}, {
'id': 1,
'name': 'Name 1',
'scheme': 'random',
'description': 'Description 1',
'version': UserPartition.VERSION,
'groups': [
{'id': 0, 'name': 'Group A', 'version': 1},
{'id': 1, 'name': 'Group B', 'version': 1},
{'id': 2, 'name': 'Group C', 'version': 1},
],
'usage': [],
}]
self.assertEqual(actual, expected)