def test_pac_total_by_committee_type(self): first_pac_total = { 'committee_id': 'C00001', 'committee_type': 'O', 'cycle': 2018, 'all_loans_received': 1, 'allocated_federal_election_levin_share': 2, } second_pac_total = { 'committee_id': 'C00002', 'committee_type': 'N', 'cycle': 2016, 'all_loans_received': 10, 'allocated_federal_election_levin_share': 20, } factories.TotalsPacFactory(**first_pac_total) factories.TotalsPacFactory(**second_pac_total) results = self._results( api.url_for(TotalsByCommitteeTypeView, committee_type='pac')) assert len(results) == 2 assert results[0]['committee_id'] == 'C00001' assert results[1]['committee_id'] == 'C00002'
def test_designation_filter(self): party_fields = { 'committee_id': 'C00001', 'cycle': 2014, 'committee_name': 'REPUBLICAN COMMITTEE', 'committee_designation': 'U', 'committee_type': 'X', 'all_loans_received': 1, 'allocated_federal_election_levin_share': 2, } factories.TotalsPacFactory(**party_fields) results = self._results( api.url_for(TotalsByCommitteeTypeView, committee_designation='U', committee_type='party')) assert len(results) == 1 self.assertEqual(results[0]['committee_designation'], party_fields['committee_designation'])
def test_Pac_totals(self): committee_id = 'C8675311' transaction_coverage = factories.TransactionCoverageFactory( # noqa committee_id=committee_id, fec_election_year=2016) history = factories.CommitteeHistoryFactory( # noqa committee_id=committee_id, committee_type='O', ) pac_fields = { 'committee_id': committee_id, 'cycle': 2016, 'all_loans_received': 1, 'allocated_federal_election_levin_share': 2, 'coordinated_expenditures_by_party_committee': 3, 'fed_candidate_committee_contributions': 4, 'fed_candidate_contribution_refunds': 5, 'fed_disbursements': 6, 'fed_election_activity': 7, 'fed_operating_expenditures': 8, 'fed_receipts': 9, 'federal_funds': 2, 'independent_expenditures': 10, 'loan_repayments_made': 11, 'loan_repayments_received': 12, 'loans_made': 13, 'loans_and_loan_repayments_received': 2, 'loans_and_loan_repayments_made': 2, 'non_allocated_fed_election_activity': 14, 'total_transfers': 15, 'other_fed_operating_expenditures': 16, 'other_fed_receipts': 17, 'shared_fed_activity': 18, 'shared_fed_activity_nonfed': 19, 'shared_fed_operating_expenditures': 20, 'shared_nonfed_operating_expenditures': 21, 'transfers_from_affiliated_party': 22, 'transfers_from_nonfed_account': 23, 'transfers_from_nonfed_levin': 24, 'transfers_to_affiliated_committee': 25, 'net_contributions': 127, 'net_operating_expenditures': 128, 'exp_subject_limits': 4, 'exp_prior_years_subject_limits': 4, 'total_exp_subject_limits': 4, 'refunds_relating_convention_exp': 4, 'itemized_refunds_relating_convention_exp': 4, 'unitemized_refunds_relating_convention_exp': 4, 'other_refunds': 4, 'itemized_other_refunds': 4, 'unitemized_other_refunds': 4, 'itemized_other_income': 4, 'unitemized_other_income': 4, 'convention_exp': 4, 'itemized_convention_exp': 4, 'unitemized_convention_exp': 4, 'itemized_other_disb': 4, 'unitemized_other_disb': 4, } fields = utils.extend(pac_fields, shared_fields) committee_total = factories.TotalsPacFactory(**fields) # noqa fields = utils.extend(fields, transaction_coverage_fields) results = self._results( api.url_for(TotalsCommitteeView, committee_id=committee_id)) self.assertEqual(results[0], fields)