当前位置: 首页>>代码示例>>Python>>正文


Python ProgramEnrollmentFactory.build方法代码示例

本文整理汇总了Python中dashboard.factories.ProgramEnrollmentFactory.build方法的典型用法代码示例。如果您正苦于以下问题:Python ProgramEnrollmentFactory.build方法的具体用法?Python ProgramEnrollmentFactory.build怎么用?Python ProgramEnrollmentFactory.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dashboard.factories.ProgramEnrollmentFactory的用法示例。


在下文中一共展示了ProgramEnrollmentFactory.build方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_index_program_enrolled_users_missing_profiles

# 需要导入模块: from dashboard.factories import ProgramEnrollmentFactory [as 别名]
# 或者: from dashboard.factories.ProgramEnrollmentFactory import build [as 别名]
 def test_index_program_enrolled_users_missing_profiles(self, mock_on_commit):
     """
     Test that index_program_enrolled_users doesn't index users missing profiles
     """
     with mute_signals(post_save):
         program_enrollments = [ProgramEnrollmentFactory.build() for _ in range(10)]
     with patch(
         'search.indexing_api._index_chunk', autospec=True, return_value=0
     ) as index_chunk, patch(
         'search.indexing_api.serialize_program_enrolled_user',
         autospec=True,
         side_effect=lambda x: None  # simulate a missing profile
     ) as serialize_mock, patch(
         'search.indexing_api.serialize_public_enrolled_user', autospec=True, side_effect=lambda x: x
     ) as serialize_public_mock:
         index_program_enrolled_users(program_enrollments)
         assert index_chunk.call_count == 0
         assert serialize_public_mock.call_count == 0
         assert serialize_mock.call_count == len(program_enrollments)
开发者ID:mitodl,项目名称:micromasters,代码行数:21,代码来源:indexing_api_test.py


注:本文中的dashboard.factories.ProgramEnrollmentFactory.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。