當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。