本文整理汇总了Python中lms.djangoapps.teams.tests.factories.CourseTeamFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Python CourseTeamFactory.create方法的具体用法?Python CourseTeamFactory.create怎么用?Python CourseTeamFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lms.djangoapps.teams.tests.factories.CourseTeamFactory
的用法示例。
在下文中一共展示了CourseTeamFactory.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_topic_with_team_count
# 需要导入模块: from lms.djangoapps.teams.tests.factories import CourseTeamFactory [as 别名]
# 或者: from lms.djangoapps.teams.tests.factories.CourseTeamFactory import create [as 别名]
def test_topic_with_team_count(self):
"""
Verifies that the `TopicSerializer` correctly displays a topic with a
positive team count, and that it only takes one SQL query.
"""
CourseTeamFactory.create(course_id=self.course.id, topic_id=self.course.teams_topics[0]['id'])
with self.assertNumQueries(1):
serializer = TopicSerializer(self.course.teams_topics[0], context={'course_id': self.course.id})
self.assertEqual(
serializer.data,
{u'name': u'Tøpic', u'description': u'The bést topic!', u'id': u'0', u'team_count': 1}
)
示例2: test_scoped_within_course
# 需要导入模块: from lms.djangoapps.teams.tests.factories import CourseTeamFactory [as 别名]
# 或者: from lms.djangoapps.teams.tests.factories.CourseTeamFactory import create [as 别名]
def test_scoped_within_course(self):
"""Verify that team counts are scoped within a course."""
teams_per_topic = 10
first_course_topics = self.setup_topics(num_topics=self.NUM_TOPICS, teams_per_topic=teams_per_topic)
duplicate_topic = first_course_topics[0]
second_course = CourseFactory.create(
teams_configuration={
"max_team_size": 10,
"topics": [duplicate_topic]
}
)
CourseTeamFactory.create(course_id=second_course.id, topic_id=duplicate_topic[u'id'])
self.assert_serializer_output(first_course_topics, num_teams_per_topic=teams_per_topic, num_queries=1)
示例3: setup_topics
# 需要导入模块: from lms.djangoapps.teams.tests.factories import CourseTeamFactory [as 别名]
# 或者: from lms.djangoapps.teams.tests.factories.CourseTeamFactory import create [as 别名]
def setup_topics(self, num_topics=5, teams_per_topic=0):
"""
Helper method to set up topics on the course. Returns a list of
created topics.
"""
self.course.teams_configuration['topics'] = []
topics = [
{u'name': u'Tøpic {}'.format(i), u'description': u'The bést topic! {}'.format(i), u'id': unicode(i)}
for i in xrange(num_topics)
]
for i in xrange(num_topics):
topic_id = unicode(i)
self.course.teams_configuration['topics'].append(topics[i])
for _ in xrange(teams_per_topic):
CourseTeamFactory.create(course_id=self.course.id, topic_id=topic_id)
return topics
示例4: setUp
# 需要导入模块: from lms.djangoapps.teams.tests.factories import CourseTeamFactory [as 别名]
# 或者: from lms.djangoapps.teams.tests.factories.CourseTeamFactory import create [as 别名]
def setUp(self):
super(MembershipSerializerTestCase, self).setUp()
self.team = CourseTeamFactory.create(
course_id=self.course.id,
topic_id=self.course.teams_topics[0]['id']
)
self.user = UserFactory.create()
CourseEnrollmentFactory.create(user=self.user, course_id=self.course.id)
self.team_membership = CourseTeamMembershipFactory.create(team=self.team, user=self.user)