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


Python ProgramFactory.create方法代碼示例

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

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

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


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