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


Python CourseFactory.create方法代码示例

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


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

示例1: test_course_publish_successfully

# 需要导入模块: from ecommerce.courses.tests.factories import CourseFactory [as 别名]
# 或者: from ecommerce.courses.tests.factories.CourseFactory import create [as 别名]
    def test_course_publish_successfully(self):
        """ Verify all courses are successfully published."""

        second_course = CourseFactory.create()
        self.create_course_ids_file(self.tmp_file_path, [self.course.id, second_course.id])
        expected = (
            (
                LOGGER_NAME,
                "INFO",
                "Publishing 2 courses."
            ),
            (
                LOGGER_NAME,
                "INFO",
                u"(1/2) Successfully published {}.".format(self.course.id)
            ),
            (
                LOGGER_NAME,
                "INFO",
                u"(2/2) Successfully published {}.".format(second_course.id)),
            (
                LOGGER_NAME,
                "INFO",
                "All 2 courses successfully published."
            )
        )
        with mock.patch.object(Course, 'publish_to_lms', autospec=True) as mock_publish:
            mock_publish.return_value = None
            with LogCapture(LOGGER_NAME) as lc:
                call_command('publish_to_lms', course_ids_file=self.tmp_file_path)
                lc.check(*expected)
        # Check that the mocked function was called twice.
        self.assertListEqual(mock_publish.call_args_list, [call(self.course), call(second_course)])
开发者ID:10clouds,项目名称:ecommerce,代码行数:35,代码来源:test_publish_to_lms_command.py


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