Esempio n. 1
0
    def test_views(self, upload_s3):
        committee = factories.CommitteeFactory(committee_type='H')
        committee_id = committee.committee_id
        factories.CommitteeHistoryFactory(committee_id=committee_id,
                                          committee_type='H')
        filing = factories.FilingsFactory(committee_id=committee_id)
        efiling = factories.EFilingsFactory(committee_id=committee_id,
                                            receipt_date=datetime.datetime(
                                                2012, 1, 1))
        basef3pfiling = factories.BaseF3PFilingFactory(
            committee_id=committee_id, receipt_date=datetime.date(2012, 1, 1))

        db.session.commit()

        for view in tasks.RESOURCE_WHITELIST:
            if view.endpoint in [
                    'reportsview',
                    'efilingsummaryview',
            ]:
                url = api.url_for(view,
                                  committee_type=committee.committee_type)
            elif view.endpoint in [
                    'filingsview',
                    'committeereportsview',
            ]:
                url = api.url_for(view, committee_id=committee.committee_id)
            else:
                url = api.url_for(view)
            tasks.export_query(url, b'')
Esempio n. 2
0
    def test_views(self, make_bundle):
        committee = factories.CommitteeFactory(committee_type='H')
        committee_id = committee.committee_id
        factories.CommitteeHistoryFactory(committee_id=committee_id,
                                          committee_type='H')
        filing = factories.FilingsFactory(committee_id=committee_id)  # noqa
        efiling = factories.EFilingsFactory(  # noqa
            committee_id=committee_id,
            receipt_date=datetime.datetime(2012, 1, 1))
        basef3pfiling = factories.BaseF3PFilingFactory(  # noqa
            committee_id=committee_id,
            receipt_date=datetime.date(2012, 1, 1))

        db.session.commit()

        # these are the major downloadable resources, we may want to add more later
        RESOURCE_WHITELIST = {
            aggregates.ScheduleABySizeView,
            aggregates.ScheduleAByStateView,
            aggregates.ScheduleAByZipView,
            aggregates.ScheduleAByEmployerView,
            aggregates.ScheduleAByOccupationView,
            aggregates.ScheduleBByRecipientView,
            aggregates.ScheduleBByRecipientIDView,
            aggregates.ScheduleBByPurposeView,
            candidate_aggregates.TotalsCandidateView,
            candidates.CandidateList,
            committees.CommitteeList,
            costs.CommunicationCostView,
            costs.ElectioneeringView,
            filings.EFilingsView,
            filings.FilingsList,
            filings.FilingsView,
            reports.ReportsView,
            reports.CommitteeReportsView,
            reports.EFilingHouseSenateSummaryView,
            reports.EFilingPresidentialSummaryView,
            reports.EFilingPacPartySummaryView,
            sched_a.ScheduleAView,
            sched_a.ScheduleAEfileView,
            sched_b.ScheduleBView,
            sched_b.ScheduleBEfileView,
            sched_d.ScheduleDView,
            sched_e.ScheduleEView,
            sched_e.ScheduleEEfileView,
            sched_f.ScheduleFView,
        }

        for view in RESOURCE_WHITELIST:
            if view.endpoint in ['reportsview']:
                url = api.url_for(view,
                                  committee_type=committee.committee_type)
            elif view.endpoint in [
                    'filingsview',
                    'committeereportsview',
            ]:
                url = api.url_for(view, committee_id=committee.committee_id)
            else:
                url = api.url_for(view)
            tasks.export_query(url, base64.b64encode(b'').decode('UTF-8'))
Esempio n. 3
0
 def test_views(self, upload_s3):
     for view in tasks.RESOURCE_WHITELIST:
         url = api.url_for(view)
         tasks.export_query(url, b'')
Esempio n. 4
0
 def test_views(self, upload_s3):
     for view in tasks.RESOURCE_WHITELIST:
         url = api.url_for(view)
         tasks.export_query(url, b'')
Esempio n. 5
0
    def test_views(self, make_bundle):
        committee = factories.CommitteeFactory(committee_type='H')
        committee_id = committee.committee_id
        factories.CommitteeHistoryFactory(
            committee_id=committee_id,
            committee_type='H'
        )
        filing = factories.FilingsFactory(committee_id=committee_id)
        efiling = factories.EFilingsFactory(
            committee_id=committee_id,
            receipt_date=datetime.datetime(2012, 1, 1)
        )
        basef3pfiling = factories.BaseF3PFilingFactory(
            committee_id=committee_id,
            receipt_date=datetime.date(2012, 1, 1)
        )

        db.session.commit()

        # these are the major downloadable resources, we may want to add more later
        RESOURCE_WHITELIST = {
            aggregates.ScheduleABySizeView,
            aggregates.ScheduleAByStateView,
            aggregates.ScheduleAByZipView,
            aggregates.ScheduleAByEmployerView,
            aggregates.ScheduleAByOccupationView,
            aggregates.ScheduleBByRecipientView,
            aggregates.ScheduleBByRecipientIDView,
            aggregates.ScheduleBByPurposeView,
            candidates.CandidateList,
            committees.CommitteeList,
            costs.CommunicationCostView,
            costs.ElectioneeringView,
            filings.EFilingsView,
            filings.FilingsList,
            filings.FilingsView,
            reports.ReportsView,
            reports.CommitteeReportsView,
            reports.EFilingHouseSenateSummaryView,
            reports.EFilingPresidentialSummaryView,
            reports.EFilingPacPartySummaryView,
            sched_a.ScheduleAView,
            sched_a.ScheduleAEfileView,
            sched_b.ScheduleBView,
            sched_b.ScheduleBEfileView,
            sched_d.ScheduleDView,
            sched_e.ScheduleEView,
            sched_e.ScheduleEEfileView,
            sched_f.ScheduleFView
        }

        for view in RESOURCE_WHITELIST:
            if view.endpoint in ['reportsview']:
                url = api.url_for(
                    view,
                    committee_type=committee.committee_type
                )
            elif view.endpoint in ['filingsview', 'committeereportsview',]:
                url = api.url_for(view, committee_id=committee.committee_id)
            else:
                url = api.url_for(view)
            tasks.export_query(url, base64.b64encode(b'').decode('UTF-8'))