def test_success_fiscal_year(database):
    """ Testing valid name for FY that matches with budget_year"""

    op = ObjectClassProgramActivityFactory(row_number=1,
                                           submission_id='1',
                                           agency_identifier='test',
                                           main_account_code='test',
                                           program_activity_name='test',
                                           program_activity_code='test')

    pa_1 = ProgramActivityFactory(budget_year=2016,
                                  agency_id='test',
                                  allocation_transfer_id='test',
                                  account_number='test',
                                  program_activity_name='test',
                                  program_activity_code='test')

    pa_2 = ProgramActivityFactory(budget_year=2017,
                                  agency_id='test2',
                                  allocation_transfer_id='test2',
                                  account_number='test2',
                                  program_activity_name='test2',
                                  program_activity_code='test2')

    submission = SubmissionFactory(submission_id='1',
                                   reporting_fiscal_year='2017')

    assert number_of_errors(_FILE,
                            database,
                            models=[op, pa_1, pa_2],
                            submission=submission) == 0
Beispiel #2
0
def test_failure(database):
    """ Testing invalid program activity name for the corresponding TAS/TAFS as defined in Section 82 of OMB Circular
    A-11. """

    af = AwardFinancialFactory(row_number=1,
                               beginning_period_of_availa=2016,
                               agency_identifier='test',
                               allocation_transfer_agency='test',
                               main_account_code='test',
                               program_activity_name='test_wrong',
                               program_activity_code='test')

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[af, pa]) == 1

    af = AwardFinancialFactory(row_number=1,
                               beginning_period_of_availa=2016,
                               agency_identifier='test',
                               allocation_transfer_agency='test',
                               main_account_code='test',
                               program_activity_name='test',
                               program_activity_code='test_wrong')

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[af, pa]) == 1

    # program activity name/code as null
    af = AwardFinancialFactory(row_number=1,
                               beginning_period_of_availa=2016,
                               agency_identifier='test_wrong',
                               allocation_transfer_agency='test',
                               main_account_code='test',
                               program_activity_name=None,
                               program_activity_code=None)

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test')

    assert number_of_errors(_FILE, database, models=[af, pa]) == 1
def test_failure_fiscal_year_quarter(database):
    """ Testing invalid program activity, does not match with fiscal_year_quarter """

    populate_publish_status(database)

    op = ObjectClassProgramActivityFactory(row_number=1,
                                           submission_id=1,
                                           agency_identifier='test2',
                                           main_account_code='test2',
                                           program_activity_name='test2',
                                           program_activity_code='test2')

    pa = ProgramActivityFactory(fiscal_year_quarter='FY15Q1',
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    submission = SubmissionFactory(
        submission_id=1,
        reporting_fiscal_year='2018',
        reporting_fiscal_period=9,
        publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE,
                            database,
                            models=[op, pa],
                            submission=submission) == 1
Beispiel #4
0
def test_failure_recertification(database):
    """ Testing invalid program_activity, not ignored since not recertification for FY2017Q2 or FY2017Q3 """

    populate_publish_status(database)

    af = AwardFinancialFactory(row_number=1,
                               submission_id=1,
                               agency_identifier='test',
                               main_account_code='test',
                               program_activity_name='test',
                               program_activity_code='test')

    pa = ProgramActivityFactory(fiscal_year_quarter='FY17Q3',
                                agency_id='test2',
                                allocation_transfer_id='test2',
                                account_number='test2',
                                program_activity_name='test2',
                                program_activity_code='test2')

    submission = SubmissionFactory(
        submission_id=1,
        reporting_fiscal_year='2017',
        reporting_fiscal_period=9,
        publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE,
                            database,
                            models=[af, pa],
                            submission=submission) == 1
def test_success_ignore_case(database):
    """ Testing program activity validation to ignore case """

    populate_publish_status(database)

    op = ObjectClassProgramActivityFactory(row_number=1,
                                           submission_id=1,
                                           beginning_period_of_availa=2016,
                                           agency_identifier='test',
                                           main_account_code='test',
                                           program_activity_name='TEST',
                                           program_activity_code='test')

    pa = ProgramActivityFactory(fiscal_year_quarter='FY17Q4',
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    submission = SubmissionFactory(
        submission_id=1,
        reporting_fiscal_year='2017',
        reporting_fiscal_period=12,
        publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE,
                            database,
                            models=[op, pa],
                            submission=submission) == 0
def test_failure_pa_code_0000(database):
    """ Failure where the program_activity_code is 0000 but program_activity_name isn't unknown/other """

    populate_publish_status(database)

    af = AwardFinancialFactory(row_number=1,
                               submission_id=1,
                               agency_identifier='test',
                               main_account_code='test',
                               program_activity_name='test',
                               program_activity_code='0000')

    pa = ProgramActivityFactory(fiscal_year_quarter='FY16Q4',
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    submission = SubmissionFactory(
        submission_id=1,
        reporting_fiscal_year='2016',
        reporting_fiscal_period=12,
        publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE,
                            database,
                            models=[af, pa],
                            submission=submission) == 1
def test_success_fiscal_year_quarter(database):
    """ Testing valid name for program_activity that matches with fiscal_year_quarter """

    populate_publish_status(database)

    af = AwardFinancialFactory(row_number=1,
                               submission_id=1,
                               agency_identifier='test',
                               main_account_code='test',
                               program_activity_name='test',
                               program_activity_code='test')

    pa = ProgramActivityFactory(fiscal_year_quarter='FY16Q1',
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    submission = SubmissionFactory(
        submission_id=1,
        reporting_fiscal_year='2016',
        reporting_fiscal_period=3,
        publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE,
                            database,
                            models=[af, pa],
                            submission=submission) == 0
def test_fail_ignore_blank_program_activity_name(database):
    """ Testing program activity name validation to not ignore blanks """
    op = ObjectClassProgramActivityFactory(row_number=1, beginning_period_of_availa=2016, agency_identifier='test',
                                           main_account_code='test', program_activity_name='',
                                           program_activity_code='test',
                                           deobligations_recov_by_pro_cpe=0, gross_outlay_amount_by_pro_cpe=0,
                                           gross_outlay_amount_by_pro_fyb=0, gross_outlays_delivered_or_cpe=0,
                                           gross_outlays_delivered_or_fyb=0, gross_outlays_undelivered_cpe=0,
                                           gross_outlays_undelivered_fyb=0, obligations_delivered_orde_cpe=0,
                                           obligations_delivered_orde_fyb=0, obligations_incurred_by_pr_cpe=0,
                                           obligations_undelivered_or_cpe=0, obligations_undelivered_or_fyb=0,
                                           ussgl480100_undelivered_or_cpe=0, ussgl480100_undelivered_or_fyb=0,
                                           ussgl480200_undelivered_or_cpe=0, ussgl480200_undelivered_or_fyb=0,
                                           ussgl483100_undelivered_or_cpe=0, ussgl483200_undelivered_or_cpe=0,
                                           ussgl487100_downward_adjus_cpe=0, ussgl487200_downward_adjus_cpe=0,
                                           ussgl488100_upward_adjustm_cpe=0, ussgl488200_upward_adjustm_cpe=0,
                                           ussgl490100_delivered_orde_cpe=0, ussgl490100_delivered_orde_fyb=0,
                                           ussgl490200_delivered_orde_cpe=0, ussgl490800_authority_outl_cpe=0,
                                           ussgl490800_authority_outl_fyb=0, ussgl493100_delivered_orde_cpe=0,
                                           ussgl497100_downward_adjus_cpe=0, ussgl497200_downward_adjus_cpe=0,
                                           ussgl498100_upward_adjustm_cpe=0, ussgl498200_upward_adjustm_cpe=0)

    pa = ProgramActivityFactory(fiscal_year_period='FYP', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[op, pa]) == 1
def test_success(database):
    """ Testing valid program activity name for the corresponding TAS/TAFS as defined in Section 82 of OMB Circular
    A-11. """

    op_1 = ObjectClassProgramActivityFactory(row_number=1,
                                             beginning_period_of_availa=2016,
                                             agency_identifier='test',
                                             allocation_transfer_agency='test',
                                             main_account_code='test',
                                             program_activity_name='test',
                                             program_activity_code='test')

    op_2 = ObjectClassProgramActivityFactory(row_number=2,
                                             beginning_period_of_availa=2016,
                                             agency_identifier='test',
                                             allocation_transfer_agency='test',
                                             main_account_code='test',
                                             program_activity_name='test',
                                             program_activity_code='test')

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[op_1, op_2, pa]) == 0
def test_failure_success_ignore_recertification(database):
    """ Testing invalid program activity, ingored since FY2017 Q2 or Q3 """

    populate_publish_status(database)

    populate_publish_status(database)

    op = ObjectClassProgramActivityFactory(row_number=1, submission_id=1, agency_identifier='test2',
                                           main_account_code='test2', program_activity_name='test2',
                                           program_activity_code='test2')

    pa = ProgramActivityFactory(fiscal_year_period='FY14P03', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    # Test with published submission
    submission = SubmissionFactory(submission_id=1, reporting_fiscal_year='2017', reporting_fiscal_period=6,
                                   publish_status_id=PUBLISH_STATUS_DICT['updated'])

    assert number_of_errors(_FILE, database, models=[op, pa], submission=submission) == 0

    # Test with unpublished submission
    submission = SubmissionFactory(submission_id=2, reporting_fiscal_year='2017', reporting_fiscal_period=6,
                                   publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE, database, models=[op, pa], submission=submission) == 0
def test_success_null_program_activity(database):
    """ program activity name/code as null """
    af = AwardFinancialFactory(row_number=1, agency_identifier='test_wrong',
                               main_account_code='test', program_activity_name=None, program_activity_code=None)

    pa = ProgramActivityFactory(fiscal_year_quarter='FYQ', agency_id='test', allocation_transfer_id='test',
                                account_number='test')

    assert number_of_errors(_FILE, database, models=[af, pa]) == 0
Beispiel #12
0
def test_failure_fiscal_year_period(database):
    """ Testing invalid program_activity, does not match with fiscal_year_period """

    populate_publish_status(database)

    af = AwardFinancialFactory(row_number=1, submission_id=1, agency_identifier='test',
                               main_account_code='test', program_activity_name='test',
                               program_activity_code='test')

    pa_1 = ProgramActivityFactory(fiscal_year_period='FPY', agency_id='test', allocation_transfer_id='test',
                                  account_number='test', program_activity_name='test', program_activity_code='test')

    pa_2 = ProgramActivityFactory(fiscal_year_period='FY16P03', agency_id='test2', allocation_transfer_id='test2',
                                  account_number='test2', program_activity_name='test2', program_activity_code='test2')

    submission = SubmissionFactory(submission_id=1, reporting_fiscal_year='2016', reporting_fiscal_period=3,
                                   publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE, database, models=[af, pa_1, pa_2], submission=submission) == 1
def test_success_ignore_case(database):
    """ Testing program activity validation to ignore case """

    af = AwardFinancialFactory(row_number=1, agency_identifier='test', main_account_code='test',
                               program_activity_name='TEST', program_activity_code='test')

    pa = ProgramActivityFactory(budget_year=2016, agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[af, pa]) == 0
def test_failure_fiscal_year(database):
    """ Testing invalid name for FY, not matches with budget_year"""

    af = AwardFinancialFactory(row_number=1, submission_id='1', agency_identifier='test3',
                               main_account_code='test3', program_activity_name='test3',
                               program_activity_code='test3')

    pa_1 = ProgramActivityFactory(budget_year=2016, agency_id='test', allocation_transfer_id='test',
                                  account_number='test', program_activity_name='test', program_activity_code='test')

    pa_2 = ProgramActivityFactory(budget_year=2017, agency_id='test2', allocation_transfer_id='test2',
                                  account_number='test2', program_activity_name='test2', program_activity_code='test2')

    pa_3 = ProgramActivityFactory(budget_year=2018, agency_id='test3', allocation_transfer_id='test3',
                                  account_number='test3', program_activity_name='test3', program_activity_code='test3')

    submission = SubmissionFactory(submission_id='1', reporting_fiscal_year='2017')

    assert number_of_errors(_FILE, database, models=[af, pa_1, pa_2, pa_3], submission=submission) == 1
def test_fail_unknown_value_0000_code_has_outlays(database):
    """ Testing invalid Unknown/other program activity name with '0000' code with obligations/outlays """

    op = ObjectClassProgramActivityFactory(row_number=1, agency_identifier='test', main_account_code='test',
                                           program_activity_name='Unknown/Other', program_activity_code='0000',
                                           deobligations_recov_by_pro_cpe=10)

    pa = ProgramActivityFactory(fiscal_year_period='FYP', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[op, pa]) == 1
Beispiel #16
0
def test_success_null(database):
    """ Program activity name/code as null """

    populate_publish_status(database)

    af = AwardFinancialFactory(row_number=1, agency_identifier='test', main_account_code='test',
                               program_activity_name=None, program_activity_code=None)

    pa = ProgramActivityFactory(fiscal_year_period='FY17P12', agency_id='test', allocation_transfer_id='test',
                                account_number='test')

    assert number_of_errors(_FILE, database, models=[af, pa]) == 0
def test_failure_program_activity_code(database):
    """Failure where the program _activity_code does not match"""
    af_1 = AwardFinancialFactory(row_number=1, agency_identifier='test',
                                 main_account_code='test', program_activity_name='test',
                                 program_activity_code='test_wrong')

    af_2 = AwardFinancialFactory(row_number=1, agency_identifier='test', main_account_code='test',
                                 program_activity_name='Unknown/Other', program_activity_code='12345')

    pa = ProgramActivityFactory(budget_year=2016, agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[af_1, af_2, pa]) == 1
def test_success(database):
    """ Testing valid program activity name for the corresponding TAS/TAFS as defined in Section 82 of OMB Circular
    A-11. """

    af_1 = AwardFinancialFactory(row_number=1, agency_identifier='test', main_account_code='test',
                                 program_activity_name='test', program_activity_code='test')

    af_2 = AwardFinancialFactory(row_number=2, agency_identifier='test', main_account_code='test',
                                 program_activity_name='test', program_activity_code='test')

    pa = ProgramActivityFactory(budget_year=2016, agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[af_1, af_2, pa]) == 0
Beispiel #19
0
def test_success_ignore_case(database):
    """ Testing program activity validation to ignore case """

    populate_publish_status(database)

    af = AwardFinancialFactory(row_number=1, submission_id=1, agency_identifier='test', main_account_code='test',
                               program_activity_name='TEST', program_activity_code='TEST')

    pa = ProgramActivityFactory(fiscal_year_period='FY16P12', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    submission = SubmissionFactory(submission_id=1, reporting_fiscal_year='2016', reporting_fiscal_period=12,
                                   publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE, database, models=[af, pa], submission=submission) == 0
Beispiel #20
0
def test_success_null(database):
    """Program activity name/code as null"""
    af = AwardFinancialFactory(row_number=1,
                               beginning_period_of_availa=2016,
                               agency_identifier='test',
                               allocation_transfer_agency='test',
                               main_account_code='test',
                               program_activity_name=None,
                               program_activity_code=None)

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test')

    assert number_of_errors(_FILE, database, models=[af, pa]) == 0
def test_success_unknown_value(database):
    """ Testing valid Unknown/other program activity name with '0000' code with no obligations/outlays """

    op_1 = ObjectClassProgramActivityFactory(row_number=1, agency_identifier='test', main_account_code='test',
                                             program_activity_name='Unknown/Other', program_activity_code='0000',
                                             deobligations_recov_by_pro_cpe=0, gross_outlay_amount_by_pro_cpe=0,
                                             gross_outlay_amount_by_pro_fyb=0, gross_outlays_delivered_or_cpe=0,
                                             gross_outlays_delivered_or_fyb=0, gross_outlays_undelivered_cpe=0,
                                             gross_outlays_undelivered_fyb=0, obligations_delivered_orde_cpe=0,
                                             obligations_delivered_orde_fyb=0, obligations_incurred_by_pr_cpe=0,
                                             obligations_undelivered_or_cpe=0, obligations_undelivered_or_fyb=0,
                                             ussgl480100_undelivered_or_cpe=0, ussgl480100_undelivered_or_fyb=0,
                                             ussgl480200_undelivered_or_cpe=0, ussgl480200_undelivered_or_fyb=-0,
                                             ussgl483100_undelivered_or_cpe=0, ussgl483200_undelivered_or_cpe=0,
                                             ussgl487100_downward_adjus_cpe=0, ussgl487200_downward_adjus_cpe=0,
                                             ussgl488100_upward_adjustm_cpe=0, ussgl488200_upward_adjustm_cpe=0,
                                             ussgl490100_delivered_orde_cpe=0, ussgl490100_delivered_orde_fyb=0,
                                             ussgl490200_delivered_orde_cpe=0, ussgl490800_authority_outl_cpe=0,
                                             ussgl490800_authority_outl_fyb=0, ussgl493100_delivered_orde_cpe=0,
                                             ussgl497100_downward_adjus_cpe=0, ussgl497200_downward_adjus_cpe=0,
                                             ussgl498100_upward_adjustm_cpe=0, ussgl498200_upward_adjustm_cpe=0)

    # Ignore case
    op_2 = ObjectClassProgramActivityFactory(row_number=1, agency_identifier='test', main_account_code='test',
                                             program_activity_name='UnknOwn/OtHer', program_activity_code='0000',
                                             deobligations_recov_by_pro_cpe=0, gross_outlay_amount_by_pro_cpe=0,
                                             gross_outlay_amount_by_pro_fyb=0, gross_outlays_delivered_or_cpe=0,
                                             gross_outlays_delivered_or_fyb=0, gross_outlays_undelivered_cpe=0,
                                             gross_outlays_undelivered_fyb=0, obligations_delivered_orde_cpe=0,
                                             obligations_delivered_orde_fyb=0, obligations_incurred_by_pr_cpe=0,
                                             obligations_undelivered_or_cpe=0, obligations_undelivered_or_fyb=0,
                                             ussgl480100_undelivered_or_cpe=0, ussgl480100_undelivered_or_fyb=0,
                                             ussgl480200_undelivered_or_cpe=0, ussgl480200_undelivered_or_fyb=-0,
                                             ussgl483100_undelivered_or_cpe=0, ussgl483200_undelivered_or_cpe=0,
                                             ussgl487100_downward_adjus_cpe=0, ussgl487200_downward_adjus_cpe=0,
                                             ussgl488100_upward_adjustm_cpe=0, ussgl488200_upward_adjustm_cpe=0,
                                             ussgl490100_delivered_orde_cpe=0, ussgl490100_delivered_orde_fyb=0,
                                             ussgl490200_delivered_orde_cpe=0, ussgl490800_authority_outl_cpe=0,
                                             ussgl490800_authority_outl_fyb=0, ussgl493100_delivered_orde_cpe=0,
                                             ussgl497100_downward_adjus_cpe=0, ussgl497200_downward_adjus_cpe=0,
                                             ussgl498100_upward_adjustm_cpe=0, ussgl498200_upward_adjustm_cpe=0)

    pa = ProgramActivityFactory(fiscal_year_period='FYP', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[op_1, op_2, pa]) == 0
def test_failure_program_activity_code(database):
    op = ObjectClassProgramActivityFactory(row_number=1,
                                           beginning_period_of_availa=2016,
                                           agency_identifier='test',
                                           allocation_transfer_agency='test',
                                           main_account_code='test',
                                           program_activity_name='test',
                                           program_activity_code='test_wrong')

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[op, pa]) == 1
Beispiel #23
0
def test_failure_program_activity_code(database):
    """Failure where the program _activity_code does not match"""
    af = AwardFinancialFactory(row_number=1,
                               beginning_period_of_availa=2016,
                               agency_identifier='test',
                               allocation_transfer_agency='test',
                               main_account_code='test',
                               program_activity_name='test',
                               program_activity_code='test_wrong')

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[af, pa]) == 1
def test_success_unknown_value(database):
    """ Testing valid Unknown/other program activity name with '0000' code """

    op = ObjectClassProgramActivityFactory(
        row_number=1,
        agency_identifier='test',
        main_account_code='test',
        program_activity_name='Unknown/Other',
        program_activity_code='0000')

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[op, pa]) == 0
def test_success_ignore_case(database):
    """ Testing program activity validation to ignore case """

    op = ObjectClassProgramActivityFactory(row_number=1,
                                           beginning_period_of_availa=2016,
                                           agency_identifier='test',
                                           main_account_code='test',
                                           program_activity_name='TEST',
                                           program_activity_code='test')

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[op, pa]) == 0
Beispiel #26
0
def test_failure_program_activity_code(database):
    """ Failure where the program_activity_code does not match """

    populate_publish_status(database)

    af_1 = AwardFinancialFactory(row_number=1, submission_id=1, agency_identifier='test',
                                 main_account_code='test', program_activity_name='test',
                                 program_activity_code='test_wrong')

    af_2 = AwardFinancialFactory(row_number=1, submission_id=1, agency_identifier='test', main_account_code='test',
                                 program_activity_name='Unknown/Other', program_activity_code='12345')

    pa = ProgramActivityFactory(fiscal_year_period='FY16P12', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    submission = SubmissionFactory(submission_id=1, reporting_fiscal_year='2016', reporting_fiscal_period=12,
                                   publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE, database, models=[af_1, af_2, pa], submission=submission) == 2
def test_failure_program_activity_name(database):
    """ Testing invalid program activity name for the corresponding TAS/TAFS as defined in Section 82 of OMB Circular
    A-11. """

    populate_publish_status(database)

    op_1 = ObjectClassProgramActivityFactory(row_number=1, agency_identifier='test', main_account_code='test',
                                             program_activity_name='test_wrong', program_activity_code='test')

    op_2 = ObjectClassProgramActivityFactory(row_number=1, agency_identifier='test', main_account_code='test',
                                             program_activity_name='test_wrong', program_activity_code='0000')

    pa = ProgramActivityFactory(fiscal_year_period='FY17P03', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    submission = SubmissionFactory(submission_id=1, reporting_fiscal_year='2017', reporting_fiscal_period=3,
                                   publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE, database, models=[op_1, op_2, pa], submission=submission) == 2
def test_success(database):
    """ Testing valid program activity name for the corresponding TAS/TAFS as defined in Section 82 of OMB Circular
         A-11.
    """

    populate_publish_status(database)

    af_1 = AwardFinancialFactory(row_number=1, agency_identifier='test', submission_id=1, main_account_code='test',
                                 program_activity_name='test', program_activity_code='test')

    af_2 = AwardFinancialFactory(row_number=2, agency_identifier='test', submission_id=1,  main_account_code='test',
                                 program_activity_name='test', program_activity_code='test')

    pa = ProgramActivityFactory(fiscal_year_quarter='FY17Q1', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    submission = SubmissionFactory(submission_id=1, reporting_fiscal_year='2017', reporting_fiscal_period=3,
                                   publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE, database, models=[af_1, af_2, pa], submission=submission) == 0
def test_success_ignore_pa_code_0000_pa_name_unknown_other(database):
    """ Test that rule is ignored when program_activity_code is 0000 AND program_activity_name is unknown/other """

    populate_publish_status(database)

    af_1 = AwardFinancialFactory(row_number=1, submission_id=1, agency_identifier='test',
                                 main_account_code='test', program_activity_name='Unknown/Other',
                                 program_activity_code='0000')

    # Ignore case
    af_2 = AwardFinancialFactory(row_number=2, submission_id=1, agency_identifier='test', main_account_code='test',
                                 program_activity_name='UnKnown/OthEr', program_activity_code='0000')

    pa = ProgramActivityFactory(fiscal_year_quarter='FY16Q4', agency_id='test', allocation_transfer_id='test',
                                account_number='test', program_activity_name='test', program_activity_code='test')

    submission = SubmissionFactory(submission_id=1, reporting_fiscal_year='2016', reporting_fiscal_period=12,
                                   publish_status_id=PUBLISH_STATUS_DICT['unpublished'])

    assert number_of_errors(_FILE, database, models=[af_1, af_2, pa], submission=submission) == 0
def test_failure_program_activity_code(database):
    op_1 = ObjectClassProgramActivityFactory(
        row_number=1,
        agency_identifier='test',
        main_account_code='test',
        program_activity_name='test',
        program_activity_code='test_wrong')

    op_2 = ObjectClassProgramActivityFactory(
        row_number=1,
        agency_identifier='test',
        main_account_code='test',
        program_activity_name='Unknown/Other',
        program_activity_code='123456')

    pa = ProgramActivityFactory(budget_year=2016,
                                agency_id='test',
                                allocation_transfer_id='test',
                                account_number='test',
                                program_activity_name='test',
                                program_activity_code='test')

    assert number_of_errors(_FILE, database, models=[op_1, op_2, pa]) == 1