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


Python factories.OpportunityFactory類代碼示例

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


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

示例1: setUp

    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,代碼行數:34,代碼來源:test_beacon_jobs.py

示例2: test_opportunity_has_docs_true

 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,代碼行數:7,代碼來源:test_opportunity_model.py

示例3: test_opportunity_closed

    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,代碼行數:18,代碼來源:test_opportunity_model.py

示例4: test_opportunity_pending

 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,代碼行數:9,代碼來源:test_opportunity_model.py

示例5: test_opportunity_notpublic

 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,代碼行數:9,代碼來源:test_opportunity_model.py

示例6: test_opportunity_open_not_published

 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,代碼行數:9,代碼來源:test_opportunity_model.py

示例7: test_can_edit_is_public

 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,代碼行數:13,代碼來源:test_opportunity_model.py

示例8: send_publish_email

    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,代碼行數:24,代碼來源:test_opportunity_model.py

示例9: insert_an_opportunity

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,代碼行數:21,代碼來源:util.py

示例10: test_opportunity_has_docs_false

 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,代碼行數:6,代碼來源:test_opportunity_model.py

示例11: test_vendor_documents_needed_with_docs

 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,代碼行數:4,代碼來源:test_opportunity_model.py

示例12: test_vendor_documents_needed_no_docs

 def test_vendor_documents_needed_no_docs(self):
     opportunity = OpportunityFactory.build()
     self.assertEquals(opportunity.get_vendor_documents(), [])
開發者ID:CityofPittsburgh,項目名稱:pittsburgh-purchasing-suite,代碼行數:3,代碼來源:test_opportunity_model.py

示例13: test_has_vendor_documents_needed_false

    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,代碼行數:6,代碼來源:test_opportunity_model.py

示例14: test_has_vendor_documents_needed_true

 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,代碼行數:3,代碼來源:test_opportunity_model.py


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