def test_correct_nightly_opportunities_queried(self):
     nightly = BeaconNewOppotunityOpenJob(time_override=True)
     opportunities = nightly.get_opportunities()
     self.assertEquals(len(opportunities), 1)
     self.assertTrue(self.opportunity in opportunities)
     self.assertFalse(self.opportunity2 in opportunities)
     self.assertFalse(self.opportunity3 in opportunities)
    def test_beacon_new_opportunity_nightly(self):
        nightly = BeaconNewOppotunityOpenJob(time_override=True)
        scheduled, existing_job = nightly.schedule_job()

        with mail.record_messages() as outbox:
            nightly.run_job(scheduled)
            self.assertEquals(len(outbox), 2)
            self.assertEquals(
                outbox[0].subject, "[Pittsburgh Purchasing] A new City of Pittsburgh opportunity from Beacon!"
            )
            self.assertTrue(self.opportunity.publish_notification_sent)
    def test_beacon_new_opportunity_nightly(self):
        nightly = BeaconNewOppotunityOpenJob(time_override=True)
        scheduled, existing_job = nightly.schedule_job()

        with mail.record_messages() as outbox:
            nightly.run_job(scheduled)
            self.assertEquals(len(outbox), 2)
            self.assertEquals(
                outbox[0].subject,
                '[Pittsburgh Purchasing] A new City of Pittsburgh opportunity from Beacon!'
            )
            self.assertTrue(self.opportunity.publish_notification_sent)