示例#1
0
    def setUp(self):
        super(TestOpportunitiesAdminBase, self).setUp()
        try:
            mkdir(current_app.config.get('UPLOAD_DESTINATION'))
        except OSError:
            rmtree(current_app.config.get('UPLOAD_DESTINATION'))
            mkdir(current_app.config.get('UPLOAD_DESTINATION'))

        import_nigp(current_app.config.get('PROJECT_ROOT') + '/test/mock/nigp.csv')

        self.department1 = DepartmentFactory(name='test')

        AcceptedEmailDomainsFactory.create(domain='foo.com')

        self.admin = UserFactory.create(
            email='*****@*****.**', roles=[RoleFactory.create(name='admin')]
        )
        self.staff = UserFactory.create(
            email='*****@*****.**', roles=[RoleFactory.create(name='staff')]
        )

        self.document = RequiredBidDocumentFactory.create()

        self.vendor = VendorFactory.create(email='*****@*****.**', business_name='foo2')

        self.opportunity1 = OpportunityFactory.create(
            contact=self.admin, created_by=self.staff,
            title=u'tést unïcode title', description=u'tést unïcode déscription',
            is_public=True, is_archived=False, planned_publish=datetime.date.today() + datetime.timedelta(1),
            planned_submission_start=datetime.date.today() + datetime.timedelta(2),
            planned_submission_end=datetime.datetime.today() + datetime.timedelta(2),
            vendor_documents_needed=[self.document.id],
            categories=(Category.query.first(),)
        ).save()
        self.opportunity2 = OpportunityFactory.create(
            contact=self.admin, created_by=self.staff,
            is_public=True, is_archived=False, planned_publish=datetime.date.today(),
            planned_submission_start=datetime.date.today() + datetime.timedelta(2),
            planned_submission_end=datetime.datetime.today() + datetime.timedelta(2),
            categories=(Category.query.first(),), enable_qa=False, qa_start=None,
            qa_end=None
        ).save()
        self.opportunity3 = OpportunityFactory.create(
            contact=self.admin, created_by=self.staff,
            is_public=True, is_archived=False, planned_publish=datetime.date.today() - datetime.timedelta(2),
            planned_submission_start=datetime.date.today() - datetime.timedelta(2),
            planned_submission_end=datetime.datetime.today() - datetime.timedelta(1),
            categories=(Category.query.first(),)
        ).save()
        self.opportunity4 = OpportunityFactory.create(
            contact=self.admin, created_by=self.staff,
            is_public=True, is_archived=False, planned_publish=datetime.date.today() - datetime.timedelta(1),
            planned_submission_start=datetime.date.today(),
            planned_submission_end=datetime.datetime.today() + datetime.timedelta(2),
            title='TEST TITLE!', categories=(Category.query.first(),)
        ).save()
示例#2
0
 def setUp(self):
     super(TestUsers, self).setUp()
     self.staff = RoleFactory.create(name='staff')
     AcceptedEmailDomainsFactory.create(domain='foo.com')
     self.new_dept = DepartmentFactory.create(name='New User').save()
     self.department1 = DepartmentFactory.create(name='Test').save()