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