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


Python OpportunityFactory.create方法代碼示例

本文整理匯總了Python中purchasing_test.factories.OpportunityFactory.create方法的典型用法代碼示例。如果您正苦於以下問題:Python OpportunityFactory.create方法的具體用法?Python OpportunityFactory.create怎麽用?Python OpportunityFactory.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在purchasing_test.factories.OpportunityFactory的用法示例。


在下文中一共展示了OpportunityFactory.create方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from purchasing_test.factories import OpportunityFactory [as 別名]
# 或者: from purchasing_test.factories.OpportunityFactory import create [as 別名]
    def setUp(self):
        super(TestBeaconJobs, self).setUp()

        self.yesterday = datetime.datetime.today() - datetime.timedelta(days=1)
        today = datetime.datetime.today()
        tomorrow = datetime.datetime.today() + datetime.timedelta(days=1)

        self.category = CategoryFactory.create()
        admin_role = RoleFactory.create(name='admin')
        self.admin = UserFactory.create(roles=[admin_role])

        self.opportunity = OpportunityFactory.create(
            is_public=True, planned_publish=today, planned_submission_start=today,
            planned_submission_end=tomorrow, categories=set([self.category]),
            created_by=self.admin, published_at=today
        )
        self.opportunity2 = OpportunityFactory.create(
            is_public=True, planned_publish=self.yesterday, planned_submission_start=today,
            planned_submission_end=tomorrow, publish_notification_sent=True,
            categories=set([self.category]), created_by=self.admin, published_at=self.yesterday
        )
        self.opportunity3 = OpportunityFactory.create(
            is_public=False, planned_publish=today, planned_submission_start=today,
            planned_submission_end=tomorrow, publish_notification_sent=False,
            categories=set([self.category]), created_by=self.admin, published_at=today
        )
        self.opportunity4 = OpportunityFactory.create(
            is_public=True, planned_publish=self.yesterday, planned_submission_start=self.yesterday,
            planned_submission_end=today, publish_notification_sent=True,
            categories=set([self.category]), created_by=self.admin, published_at=self.yesterday
        )

        VendorFactory.create(opportunities=set([self.opportunity]))
        VendorFactory.create(categories=set([self.category]))
開發者ID:CityofPittsburgh,項目名稱:pittsburgh-purchasing-suite,代碼行數:36,代碼來源:test_beacon_jobs.py

示例2: insert_an_opportunity

# 需要導入模塊: from purchasing_test.factories import OpportunityFactory [as 別名]
# 或者: from purchasing_test.factories.OpportunityFactory import create [as 別名]
def insert_an_opportunity(
    contact=None, department=None,
    title='Test', description='Test',
    planned_publish=datetime.datetime.today(),
    planned_submission_start=datetime.datetime.today(),
    planned_submission_end=datetime.datetime.today() + datetime.timedelta(1),
    required_documents=[], categories=set(), documents=[],
    created_from_id=None, created_by=None, is_public=True
):
    department = department if department else DepartmentFactory()
    opportunity = OpportunityFactory.create(**dict(
        department_id=department.id, contact=contact, title=title,
        description=description, planned_publish=planned_publish,
        planned_submission_start=planned_submission_start,
        planned_submission_end=planned_submission_end,
        created_from_id=created_from_id, created_by=created_by,
        created_by_id=created_by.id, vendor_documents_needed=documents,
        is_public=is_public, categories=categories
    ))

    return opportunity
開發者ID:TMarkos,項目名稱:pittsburgh-purchasing-suite,代碼行數:23,代碼來源:util.py


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