当前位置: 首页>>代码示例>>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;未经允许,请勿转载。