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]))
def setUp(self): super(TestOpportunitiesPublic, self).setUp() self.opportunity3.is_public = False self.opportunity3.categories = set([Category.query.all()[-1]]) self.vendor = VendorFactory.create( business_name='foobar', email='*****@*****.**', categories=set([Category.query.all()[-1]]) ) db.session.commit() self.opportunity1.created_by = self.staff self.opportunity3.created_by = self.staff