本文整理匯總了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)