当前位置: 首页>>代码示例>>Python>>正文


Python OpportunityFactory.build方法代码示例

本文整理汇总了Python中purchasing_test.factories.OpportunityFactory.build方法的典型用法代码示例。如果您正苦于以下问题:Python OpportunityFactory.build方法的具体用法?Python OpportunityFactory.build怎么用?Python OpportunityFactory.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在purchasing_test.factories.OpportunityFactory的用法示例。


在下文中一共展示了OpportunityFactory.build方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_opportunity_has_docs_true

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_opportunity_has_docs_true(self):
     opp = OpportunityFactory.build(
         is_public=False, planned_publish=self.yesterday,
         planned_submission_start=self.today, planned_submission_end=self.tomorrow,
         opportunity_documents=[OpportunityDocumentFactory.build()]
     )
     self.assertTrue(opp.has_docs)
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:9,代码来源:test_opportunity_model.py

示例2: test_opportunity_closed

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
    def test_opportunity_closed(self):
        closed_opportunity = OpportunityFactory.build(
            is_public=True, planned_publish=self.yesterday,
            planned_submission_start=self.yesterday, planned_submission_end=self.yesterday
        )
        self.assertTrue(closed_opportunity.is_published)
        self.assertFalse(closed_opportunity.is_upcoming)
        self.assertFalse(closed_opportunity.is_submission_start)
        self.assertTrue(closed_opportunity.is_submission_end)

        closed_opportunity_today_deadline = OpportunityFactory.build(
            is_public=True, planned_publish=self.yesterday,
            planned_submission_start=self.yesterday, planned_submission_end=self.today
        )
        self.assertTrue(closed_opportunity_today_deadline.is_published)
        self.assertFalse(closed_opportunity_today_deadline.is_upcoming)
        self.assertFalse(closed_opportunity_today_deadline.is_submission_start)
        self.assertTrue(closed_opportunity_today_deadline.is_submission_end)
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:20,代码来源:test_opportunity_model.py

示例3: test_opportunity_pending

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_opportunity_pending(self):
     pending_opportunity = OpportunityFactory.build(
         is_public=True, planned_publish=self.yesterday,
         planned_submission_start=self.tomorrow, planned_submission_end=self.tomorrow
     )
     self.assertTrue(pending_opportunity.is_published)
     self.assertTrue(pending_opportunity.is_upcoming)
     self.assertFalse(pending_opportunity.is_submission_start)
     self.assertFalse(pending_opportunity.is_submission_end)
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:11,代码来源:test_opportunity_model.py

示例4: test_opportunity_notpublic

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_opportunity_notpublic(self):
     notpublic_opportunity = OpportunityFactory.build(
         is_public=False, planned_publish=self.yesterday,
         planned_submission_start=self.today, planned_submission_end=self.tomorrow
     )
     self.assertFalse(notpublic_opportunity.is_published)
     self.assertFalse(notpublic_opportunity.is_upcoming)
     self.assertFalse(notpublic_opportunity.is_submission_start)
     self.assertFalse(notpublic_opportunity.is_submission_end)
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:11,代码来源:test_opportunity_model.py

示例5: test_opportunity_open_not_published

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_opportunity_open_not_published(self):
     open_opportunity = OpportunityFactory.build(
         is_public=True, planned_publish=self.tomorrow,
         planned_submission_start=self.today, planned_submission_end=self.tomorrow
     )
     self.assertFalse(open_opportunity.is_published)
     self.assertFalse(open_opportunity.is_upcoming)
     self.assertFalse(open_opportunity.is_submission_start)
     self.assertFalse(open_opportunity.is_submission_end)
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:11,代码来源:test_opportunity_model.py

示例6: test_can_edit_is_public

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_can_edit_is_public(self):
     staff = UserFactory.build(roles=[RoleFactory.build(name='staff')])
     creator = UserFactory.build(roles=[RoleFactory.build(name='staff')])
     admin = UserFactory.build(roles=[RoleFactory.build(name='admin')])
     opportunity = OpportunityFactory.build(
         is_public=True, planned_publish=self.yesterday,
         planned_submission_start=self.today, planned_submission_end=self.tomorrow,
         created_by=creator, created_by_id=creator.id,
         contact_id=creator.id
     )
     self.assertFalse(opportunity.can_edit(staff))
     self.assertFalse(opportunity.can_edit(creator))
     self.assertTrue(opportunity.can_edit(admin))
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:15,代码来源:test_opportunity_model.py

示例7: send_publish_email

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
    def send_publish_email(self, send):
        should_send = OpportunityFactory.build(
            is_public=True, planned_publish=self.yesterday,
            planned_submission_end=self.tomorrow,
            publish_notification_sent=False
        )
        self.assertTrue(should_send.send_publish_email())
        self.assertTrue(send.called_once)

        should_not_send = OpportunityFactory.build(
            is_public=True, planned_publish=self.yesterday,
            planned_submission_end=self.tomorrow,
            publish_notification_sent=True
        )
        self.assertFalse(should_not_send.send_publish_email())
        self.assertTrue(send.called_once)

        should_not_send2 = OpportunityFactory.build(
            is_public=False, planned_publish=self.yesterday,
            planned_submission_end=self.tomorrow,
            publish_notification_sent=False
        )
        self.assertFalse(should_not_send2.send_publish_email())
        self.assertTrue(send.called_once)
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:26,代码来源:test_opportunity_model.py

示例8: test_opportunity_has_docs_false

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_opportunity_has_docs_false(self):
     opp = OpportunityFactory.build(
         is_public=False, planned_publish=self.yesterday,
         planned_submission_start=self.today, planned_submission_end=self.tomorrow
     )
     self.assertFalse(opp.has_docs)
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:8,代码来源:test_opportunity_model.py

示例9: test_vendor_documents_needed_with_docs

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_vendor_documents_needed_with_docs(self, query):
     opportunity = OpportunityFactory.build(vendor_documents_needed=[1])
     opportunity.get_vendor_documents()
     self.assertTrue(query.filter.called)
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:6,代码来源:test_opportunity_model.py

示例10: test_vendor_documents_needed_no_docs

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_vendor_documents_needed_no_docs(self):
     opportunity = OpportunityFactory.build()
     self.assertEquals(opportunity.get_vendor_documents(), [])
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:5,代码来源:test_opportunity_model.py

示例11: test_has_vendor_documents_needed_false

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
    def test_has_vendor_documents_needed_false(self):
        opportunity = OpportunityFactory.build()
        self.assertFalse(opportunity.has_vendor_documents())

        opportunity2 = OpportunityFactory.build(vendor_documents_needed=[])
        self.assertFalse(opportunity.has_vendor_documents())
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:8,代码来源:test_opportunity_model.py

示例12: test_has_vendor_documents_needed_true

# 需要导入模块: from purchasing_test.factories import OpportunityFactory [as 别名]
# 或者: from purchasing_test.factories.OpportunityFactory import build [as 别名]
 def test_has_vendor_documents_needed_true(self):
     opportunity = OpportunityFactory.build(vendor_documents_needed=[1])
     self.assertTrue(opportunity.has_vendor_documents())
开发者ID:CityofPittsburgh,项目名称:pittsburgh-purchasing-suite,代码行数:5,代码来源:test_opportunity_model.py


注:本文中的purchasing_test.factories.OpportunityFactory.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。