本文整理汇总了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