def single_file_warnings(self):
    self.cleanup()
    (report_headers, report_content) = self.generate_file_report(APPROP_FILE, 'appropriations', warning=True)
    appro_count = self.session.query(Appropriation).filter_by(submission_id=self.submission_id).count()
    assert (appro_count == 10)
    flex_count = self.session.query(FlexField).filter_by(submission_id=self.submission_id).count()
    assert (flex_count == 20)
    error_count = self.session.query(ErrorMetadata).filter_by(job_id=self.val_job.job_id, severity_id=RULE_SEVERITY_DICT['warning']).count()
    assert (self.validator.job.number_of_rows == 11)
    assert (self.validator.job.number_of_rows_valid == 10)
    assert (error_count == 0)
    assert (report_headers == self.validator.report_headers)
    assert (len(report_content) == 0)
    self.cleanup()
    (report_headers, report_content) = self.generate_file_report(BLANK_C, 'award_financial', warning=True)
    awfin_count = self.session.query(AwardFinancial).filter_by(submission_id=self.submission_id).count()
    assert (awfin_count == 0)
    flex_count = self.session.query(FlexField).filter_by(submission_id=self.submission_id).count()
    assert (flex_count == 0)
    error_count = self.session.query(ErrorMetadata).filter_by(job_id=self.val_job.job_id, severity_id=RULE_SEVERITY_DICT['warning']).count()
    assert (self.validator.job.number_of_rows == 1)
    assert (self.validator.job.number_of_rows_valid == 2)
    assert (error_count == 1)
    assert (report_headers == self.validator.report_headers)
    expected_values = [{'Unique ID': '', 'Field Name': 'Blank File', 'Rule Message': 'File does not contain data. For files A and B, this must be addressed prior to publication/certification. Blank file C does not prevent publication/certification.', 'Value Provided': '', 'Expected Value': '', 'Difference': '', 'Flex Field': '', 'Row Number': '', 'Rule Label': 'DABSBLANK'}]
    assert (report_content == expected_values)
    self.cleanup()
    (report_headers, report_content) = self.generate_file_report(RULE_FAILED_WARNING, 'appropriations', warning=True)
    appro_count = self.session.query(Appropriation).filter_by(submission_id=self.submission_id).count()
    assert (appro_count == 10)
    flex_count = self.session.query(FlexField).filter_by(submission_id=self.submission_id).count()
    assert (flex_count == 20)
    error_count = self.session.query(ErrorMetadata).filter_by(job_id=self.val_job.job_id, severity_id=RULE_SEVERITY_DICT['warning']).count()
    assert (self.validator.job.number_of_rows == 11)
    assert (self.validator.job.number_of_rows_valid == 10)
    assert (error_count == 1)
    assert (report_headers == self.validator.report_headers)
    expected_values = [{'Unique ID': 'TAS: 028-2010/2011-0406-000', 'Field Name': 'budgetauthorityunobligatedbalancebroughtforward_fyb', 'Rule Message': 'All the elements that have FYB in file A are expected in the first submission for a fiscal year', 'Value Provided': 'budgetauthorityunobligatedbalancebroughtforward_fyb: ', 'Expected Value': 'If the reporting period is Quarter 1, a non-null amount should be submitted for the following elements: BudgetAuthorityUnobligatedBalanceBroughtForward_FYB', 'Difference': '', 'Flex Field': 'flex_field_a: FLEX_A, flex_field_b: FLEX_B', 'Row Number': '5', 'Rule Label': 'A16.1'}]
    assert (report_content == expected_values)
    self.cleanup()
def single_file_warnings(self):
    self.cleanup()
    (report_headers, report_content) = self.generate_file_report(APPROP_FILE, 'appropriations', warning=True)
    appro_count = self.session.query(Appropriation).filter_by(submission_id=self.submission_id).count()
    assert (appro_count == 10)
    flex_count = self.session.query(FlexField).filter_by(submission_id=self.submission_id).count()
    assert (flex_count == 20)
    error_count = self.session.query(ErrorMetadata).filter_by(job_id=self.val_job.job_id, severity_id=RULE_SEVERITY_DICT['warning']).count()
    assert (self.validator.job.number_of_rows == 11)
    assert (self.validator.job.number_of_rows_valid == 10)
    assert (error_count == 0)
    assert (report_headers == self.validator.report_headers)
    assert (len(report_content) == 0)
    self.cleanup()
    (report_headers, report_content) = self.generate_file_report(BLANK_C, 'award_financial', warning=True)
    awfin_count = self.session.query(AwardFinancial).filter_by(submission_id=self.submission_id).count()
    assert (awfin_count == 0)
    flex_count = self.session.query(FlexField).filter_by(submission_id=self.submission_id).count()
    assert (flex_count == 0)
    error_count = self.session.query(ErrorMetadata).filter_by(job_id=self.val_job.job_id, severity_id=RULE_SEVERITY_DICT['warning']).count()
    assert (self.validator.job.number_of_rows == 1)
    assert (self.validator.job.number_of_rows_valid == 2)
    assert (error_count == 1)
    assert (report_headers == self.validator.report_headers)
    expected_values = [{'Unique ID': , 'Field Name': 'Blank File', 'Rule Message': 'File does not contain data. For files A and B, this must be addressed prior to publication/certification. Blank file C does not prevent publication/certification.', 'Value Provided': , 'Expected Value': , 'Difference': , 'Flex Field': , 'Row Number': , 'Rule Label': 'DABSBLANK'}]
    assert (report_content == expected_values)
    self.cleanup()
    (report_headers, report_content) = self.generate_file_report(RULE_FAILED_WARNING, 'appropriations', warning=True)
    appro_count = self.session.query(Appropriation).filter_by(submission_id=self.submission_id).count()
    assert (appro_count == 10)
    flex_count = self.session.query(FlexField).filter_by(submission_id=self.submission_id).count()
    assert (flex_count == 20)
    error_count = self.session.query(ErrorMetadata).filter_by(job_id=self.val_job.job_id, severity_id=RULE_SEVERITY_DICT['warning']).count()
    assert (self.validator.job.number_of_rows == 11)
    assert (self.validator.job.number_of_rows_valid == 10)
    assert (error_count == 1)
    assert (report_headers == self.validator.report_headers)
    expected_values = [{'Unique ID': 'TAS: 028-2010/2011-0406-000', 'Field Name': 'budgetauthorityunobligatedbalancebroughtforward_fyb', 'Rule Message': 'All the elements that have FYB in file A are expected in the first submission for a fiscal year', 'Value Provided': 'budgetauthorityunobligatedbalancebroughtforward_fyb: ', 'Expected Value': 'If the reporting period is Quarter 1, a non-null amount should be submitted for the following elements: BudgetAuthorityUnobligatedBalanceBroughtForward_FYB', 'Difference': , 'Flex Field': 'flex_field_a: FLEX_A, flex_field_b: FLEX_B', 'Row Number': '5', 'Rule Label': 'A16.1'}]
    assert (report_content == expected_values)
    self.cleanup()