當前位置: 首頁>>代碼示例>>Python>>正文


Python CourseTeamFactory.create方法代碼示例

本文整理匯總了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}
         )
開發者ID:10clouds,項目名稱:edx-platform,代碼行數:14,代碼來源:test_serializers.py

示例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)
開發者ID:10clouds,項目名稱:edx-platform,代碼行數:15,代碼來源:test_serializers.py

示例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
開發者ID:10clouds,項目名稱:edx-platform,代碼行數:18,代碼來源:test_serializers.py

示例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)
開發者ID:10clouds,項目名稱:edx-platform,代碼行數:11,代碼來源:test_serializers.py


注:本文中的lms.djangoapps.teams.tests.factories.CourseTeamFactory.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。