def test_inaugural_summary( self, load_committee_history_mock, load_cycle_data_mock, load_reports_and_totals_mock, load_endpoint_results_mock, load_committee_statement_of_organization_mock, ): cycle = 2018 test_committee = copy.deepcopy(self.STOCK_COMMITTEE) test_committee["organization_type"] = "I" load_committee_history_mock.return_value = (test_committee, [], cycle) load_cycle_data_mock.return_value = (False, 2018, [2018]) load_reports_and_totals_mock.return_value = ( {"report_type_full": "POST INAUGURAL SUPPLEMENT", "report_type": "90S"}, {"receipts": 85530042.0, "contribution_refunds": 966240.0}, ) committee = views.get_committee("C001", 2018) assert committee["inaugural_summary"] == [ (85530042.0, {"label": "Total Donations Accepted", "level": "1"}), (966240.0, {"label": "Total Donations Refunded", "level": "1"}), ]
def test_ie_summary( self, load_committee_history_mock, load_cycle_data_mock, load_reports_and_totals_mock, load_endpoint_results_mock, load_committee_statement_of_organization_mock, ): cycle = 2018 test_committee = copy.deepcopy(self.STOCK_COMMITTEE) test_committee["committee_type"] = "I" load_committee_history_mock.return_value = (test_committee, [], cycle) # cycle_out_of_range, last_cycle_has_financial, cycles load_cycle_data_mock.return_value = (False, 2018, [2018]) load_reports_and_totals_mock.return_value = ( {"report_type_full": "YEAR-END", "report_type": "YE"}, { "total_independent_contributions": 11000.0, "total_independent_expenditures": 4262.0, }, ) template_variables = views.get_committee("C001", 2018) assert template_variables["ie_summary"] == [ (11000.0, {"label": "Contributions received", "level": "1"}), (4262.0, {"label": "Independent expenditures", "level": "1"}), ]
def test_base_case( self, load_committee_history_mock, load_cycle_data_mock, load_reports_and_totals_mock, load_endpoint_results_mock, load_committee_statement_of_organization_mock, ): cycle = 2018 test_committee = copy.deepcopy(self.STOCK_COMMITTEE) load_committee_history_mock.return_value = (test_committee, [], cycle) # cycle_out_of_range, last_cycle_has_financial, cycles load_cycle_data_mock.return_value = (False, 2018, [2018]) load_reports_and_totals_mock.return_value = ( self.STOCK_REPORTS, self.STOCK_TOTALS, ) load_endpoint_results_mock.return_value = mock.MagicMock() load_committee_statement_of_organization_mock.return_value = { "receipt_date": "2019-11-30T00:00:00" } template_variables = views.get_committee("C001", 2018) committee = template_variables.get("committee") assert committee["name"] == test_committee["name"] assert committee["committee_id"] == test_committee["committee_id"] assert committee["committee_type_full"] == test_committee["committee_type_full"] assert committee["committee_type"] == test_committee["committee_type"] assert committee["designation_full"] == test_committee["designation_full"] assert committee["street_1"] == test_committee["street_1"] assert committee["street_2"] == test_committee["street_2"] assert committee["city"] == test_committee["city"] assert committee["state"] == test_committee["state"] assert committee["zip"] == test_committee["zip"] assert committee["treasurer_name"] == test_committee["treasurer_name"] assert committee["party_full"] == test_committee["party_full"] assert template_variables["context_vars"] == { "cycle": 2018, "timePeriod": "2017–2018", "name": "MY JOINT FUNDRAISING COMMITTEE", "cycleOutOfRange": False, "lastCycleHasFinancial": 2018, } assert template_variables["parent"] == "data" assert template_variables["totals"] == [] assert template_variables["candidates"] == [] assert template_variables["cycle"] == cycle assert template_variables["cycles"] == test_committee["cycles_has_activity"] assert template_variables["year"] == test_committee["cycle"] assert template_variables["result_type"] == "committees" assert template_variables["report_type"] == "pac-party" assert template_variables["reports"] == self.STOCK_REPORTS assert template_variables["statement_of_organization"] == { "receipt_date": "11/30/2019" }
def test_host_f3x_summary_returns_standard_values( self, load_committee_history_mock, load_cycle_data_mock, load_reports_and_totals_mock, load_endpoint_results_mock, load_committee_statement_of_organization_mock, ): cycle = 2018 test_committee = copy.deepcopy(self.STOCK_COMMITTEE) test_committee["organization_type"] = "H" load_committee_history_mock.return_value = (test_committee, [], cycle) load_cycle_data_mock.return_value = (False, 2018, [2018]) load_reports_and_totals_mock.return_value = ( self.STOCK_REPORTS, self.STOCK_TOTALS, ) template_variables = views.get_committee("C001", 2018) committee = template_variables.get("committee") assert committee["name"] == test_committee["name"] assert committee["committee_id"] == test_committee["committee_id"] assert committee["committee_type_full"] == test_committee[ "committee_type_full"] assert committee["committee_type"] == test_committee["committee_type"] assert committee["designation_full"] == test_committee[ "designation_full"] assert committee["street_1"] == test_committee["street_1"] assert committee["street_2"] == test_committee["street_2"] assert committee["city"] == test_committee["city"] assert committee["state"] == test_committee["state"] assert committee["zip"] == test_committee["zip"] assert committee["treasurer_name"] == test_committee["treasurer_name"] assert committee["cycle"] == test_committee["cycle"] assert committee["cycles"] == test_committee["cycles"] assert committee["party_full"] == test_committee["party_full"] assert template_variables["year"] == test_committee["cycle"] assert template_variables["parent"] == "data" assert template_variables["context_vars"] == { "cycle": 2018, "timePeriod": "2017–2018", "name": "MY JOINT FUNDRAISING COMMITTEE", "cycleOutOfRange": False, "lastCycleHasFinancial": 2018, } assert template_variables["totals"] == [] assert template_variables["candidates"] == [] assert template_variables["result_type"] == "committees" assert template_variables["report_type"] == "pac-party" assert template_variables["reports"] == self.STOCK_REPORTS
def test_host_f4_summary( self, load_committee_history_mock, load_cycle_data_mock, load_reports_and_totals_mock, load_endpoint_results_mock, load_committee_statement_of_organization_mock, ): cycle = 2018 test_committee = copy.deepcopy(self.STOCK_COMMITTEE) test_committee["organization_type"] = "H" load_committee_history_mock.return_value = (test_committee, [], cycle) load_cycle_data_mock.return_value = (False, 2018, [2018]) load_reports_and_totals_mock.return_value = ( { "report_type_full": "POST INAUGURAL SUPPLEMENT", "report_type": "90S", "form_type": "F4", }, { "cash_on_hand_beginning_period": 503347.81, "committee_name": "COMMITTEE FOR CHARLOTTE_CHARLOTTE DNC HOST COMMITTEE", "other_disbursements": 0.0, "last_beginning_image_number": "201610109032226424", "itemized_refunds_relating_convention_exp": 0.0, "committee_designation_full": "Unauthorized", "refunds_relating_convention_exp": 0.0, "cycle": 2016, "committee_type_full": "Party - Nonqualified", "individual_contributions": 0.0, "unitemized_other_disb": 0.0, "loans_and_loan_repayments_received": 0.0, "last_report_year": 2016, "itemized_other_disb": 0.0, "coverage_start_date": "2016-07-01T00:00:00+00:00", "itemized_other_income": 0.0, "itemized_convention_exp": 4500.0, "exp_subject_limits": 4500.0, "other_refunds": 0.0, "last_cash_on_hand_end_period": 498847.81, "exp_prior_years_subject_limits": 0.0, "all_loans_received": 0.0, "last_report_type_full": "OCTOBER QUARTERLY", "loans_made": 0.0, "unitemized_other_income": 0.0, "loans_and_loan_repayments_made": 0.0, "receipts": 12345.0, "committee_id": "C00493254", "fed_disbursements": 0.0, "committee_designation": "U", "loan_repayments_received": 0.0, "itemized_other_refunds": 0.0, "unitemized_other_refunds": 0.0, "unitemized_refunds_relating_convention_exp": 0.0, "contributions": 0.0, "transfers_from_affiliated_party": 0.0, "coverage_end_date": "2016-09-30T00:00:00+00:00", "convention_exp": 4500.0, "individual_unitemized_contributions": 0.0, "federal_funds": 12345.0, "transfers_to_affiliated_committee": 0.0, "other_fed_receipts": 0.0, "party_full": "DEMOCRATIC PARTY", "last_debts_owed_by_committee": 5000, "loan_repayments_made": 0.0, "unitemized_convention_exp": 0.0, "committee_type": "X", "disbursements": 4500.0, "last_debts_owed_to_committee": 1000, "total_exp_subject_limits": None, }, ) template_variables = views.get_committee("C001", 2018) assert template_variables["raising_summary"] == [ ( 12345.0, {"label": "Total receipts", "level": "1", "term": "total receipts"}, ), (12345.0, {"label": "Federal funds", "level": "2"}), ( 0.0, { "label": "Total Contributions to Defray Convention Expenses", "level": "2", }, ), ( 0.0, { "label": "Itemized Contributions to Defray Convention Expenses", "level": "3", }, ), ( 0.0, { "label": "Unitemized Contributions to Defray Convention Expenses", "level": "3", }, ), (0.0, {"label": "Transfers from affiliated committees", "level": "2"}), (0.0, {"label": "Loans Received", "level": "3"}), (0.0, {"label": "Loan Repayments Received", "level": "3"}), ( 0.0, {"label": "Other Refunds, Rebates, Returns of Deposits", "level": "2"}, ), ( 0.0, { "label": " Itemized Other Refunds, Rebates, Returns of Deposits", "level": "3", }, ), ( 0.0, { "label": "Unitemized Other Refunds, Rebates, Returns of Deposits", "level": "3", }, ), (0.0, {"label": " Other Income", "level": "2"}), (0.0, {"label": "Itemized Other Income", "level": "3"}), (0.0, {"label": "Unitemized Other Income", "level": "3"}), ] assert template_variables["spending_summary"] == [ ( 4500.0, { "label": "Total disbursements", "level": "1", "term": "total disbursements", }, ), (4500.0, {"label": "Convention Expenditures", "level": "2"}), (4500.0, {"label": "Itemized Convention Expenditures", "level": "3"}), (0.0, {"label": "Unitemized Convention Expenditures", "level": "3"}), (0.0, {"label": "Transfers to Affiliated Committees", "level": "2"}), (0.0, {"label": "Loans and Loan Repayments Made", "level": "2"}), (0.0, {"label": "Loans Made", "level": "3"}), (0.0, {"label": "Loan Repayments Made", "level": "3"}), (0.0, {"label": "Other Disbursements", "level": "2"}), (0.0, {"label": "Itemized Other Disbursements", "level": "3"}), (0.0, {"label": "Unitemized Other Disbursements", "level": "3"}), ] assert template_variables["cash_summary"] == [ (503347.81, {"label": "Beginning cash on hand", "level": "2"}), ( 498847.81, { "label": "Ending cash on hand", "term": "ending cash on hand", "level": "2", }, ), (1000, {"label": "Debts/loans owed to committee", "level": "2"}), (5000, {"label": "Debts/loans owed by committee", "level": "2"}), ]