本文整理汇总了Python中openedx.core.djangoapps.catalog.tests.factories.ProgramFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Python ProgramFactory.create方法的具体用法?Python ProgramFactory.create怎么用?Python ProgramFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openedx.core.djangoapps.catalog.tests.factories.ProgramFactory
的用法示例。
在下文中一共展示了ProgramFactory.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_catalog_program
# 需要导入模块: from openedx.core.djangoapps.catalog.tests.factories import ProgramFactory [as 别名]
# 或者: from openedx.core.djangoapps.catalog.tests.factories.ProgramFactory import create [as 别名]
def _create_catalog_program(self, catalog_org):
""" helper method to create a cached catalog program """
program = ProgramFactory.create(
authoring_organizations=[catalog_org]
)
cache.set(PROGRAM_CACHE_KEY_TPL.format(uuid=program['uuid']), program, None)
return program
示例2: setup_catalog_cache
# 需要导入模块: from openedx.core.djangoapps.catalog.tests.factories import ProgramFactory [as 别名]
# 或者: from openedx.core.djangoapps.catalog.tests.factories.ProgramFactory import create [as 别名]
def setup_catalog_cache(self, program_uuid, organization_key):
"""
helper function to initialize a cached program with an single authoring_organization
"""
catalog_org = CatalogOrganizationFactory.create(key=organization_key)
program = ProgramFactory.create(
uuid=program_uuid,
authoring_organizations=[catalog_org]
)
cache.set(PROGRAM_CACHE_KEY_TPL.format(uuid=program_uuid), program, None)
示例3: test_catalog_program_missing_org
# 需要导入模块: from openedx.core.djangoapps.catalog.tests.factories import ProgramFactory [as 别名]
# 或者: from openedx.core.djangoapps.catalog.tests.factories.ProgramFactory import create [as 别名]
def test_catalog_program_missing_org(self):
"""
Test OrganizationDoesNotExistException is thrown if the cached program does not
have an authoring organization.
"""
program = ProgramFactory.create(
uuid=self.program_uuid,
authoring_organizations=[]
)
cache.set(PROGRAM_CACHE_KEY_TPL.format(uuid=self.program_uuid), program, None)
organization = OrganizationFactory.create(short_name=self.organization_key)
provider = SAMLProviderConfigFactory.create(organization=organization)
self.create_social_auth_entry(self.user, provider, self.external_user_id)
with pytest.raises(OrganizationDoesNotExistException):
get_user_by_program_id(self.external_user_id, self.program_uuid)