Ejemplo n.º 1
0
def test_obtain_state_totals_loan_agg(state_view_loan_data):
    result = obtain_state_totals("01", str(generate_fiscal_year(OUTSIDE_OF_LATEST)))
    expected = {
        "pop_state_code": "AB",
        "total": 25,
        "count": 2,
        "total_face_value_loan_amount": 1511,
    }
    assert result == expected
Ejemplo n.º 2
0
def test_obtain_state_totals_none(state_view_data, monkeypatch):
    monkeypatch.setattr("usaspending_api.recipient.v2.views.states.VALID_FIPS",
                        {"02": {
                            "code": "No State"
                        }})
    result = obtain_state_totals("02")
    expected = {"pop_state_code": None, "total": 0, "count": 0}

    assert result == expected
Ejemplo n.º 3
0
def test_obtain_state_totals_none(state_view_data, refresh_matviews,
                                  monkeypatch):
    monkeypatch.setattr('usaspending_api.recipient.v2.views.states.VALID_FIPS',
                        {'02': {
                            'code': 'No State'
                        }})
    result = obtain_state_totals('02')
    expected = {'pop_state_code': None, 'total': 0, 'count': 0}

    assert result == expected
Ejemplo n.º 4
0
def test_obtain_state_totals(state_view_data):
    result = obtain_state_totals("01",
                                 str(generate_fiscal_year(OUTSIDE_OF_LATEST)),
                                 ["A"])
    expected = {"pop_state_code": "AB", "total": 10, "count": 1}
    assert result == expected
Ejemplo n.º 5
0
def test_obtain_state_totals(state_view_data, refresh_matviews):
    result = obtain_state_totals('01',
                                 str(generate_fiscal_year(OUTSIDE_OF_LATEST)),
                                 ['A'])
    expected = {'pop_state_code': 'AB', 'total': 10, 'count': 1}
    assert result == expected
def test_obtain_state_totals_none(state_view_data, refresh_matviews, monkeypatch):
    monkeypatch.setattr('usaspending_api.recipient.v2.views.states.VALID_FIPS', {'02': {'code': 'No State'}})
    result = obtain_state_totals('02')
    expected = {'pop_state_code': None, 'total': 0, 'count': 0}

    assert result == expected
def test_obtain_state_totals(state_view_data, refresh_matviews):
    result = obtain_state_totals('01', str(generate_fiscal_year(OUTSIDE_OF_LATEST)), ['A'])
    expected = {'pop_state_code': 'AB', 'total': 10, 'count': 1}
    assert result == expected