Skip to content

Commit

Permalink
Test cases for multiple base years
Browse files Browse the repository at this point in the history
  • Loading branch information
gsa-suk committed Nov 26, 2024
1 parent 5c0eb98 commit af96e0c
Showing 1 changed file with 92 additions and 29 deletions.
121 changes: 92 additions & 29 deletions backend/support/test_cog_over.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def _fake_general():
"auditee_fiscal_period_start": "2022-11-01",
"user_provided_organization_type": "state",
"auditor_ein_not_an_ssn_attestation": "true",
"audit_year": "2023",
}

@staticmethod
Expand Down Expand Up @@ -287,8 +288,6 @@ def _fake_sac(self):
general_information=self._fake_general(),
federal_awards=self._fake_federal_awards(),
)
audit_date = sac.general_information["auditee_fiscal_period_end"]
sac.audit_year = int(audit_date.split("-")[0])
return sac

def test_cog_assignment_from_hist(self):
Expand All @@ -299,7 +298,7 @@ def test_cog_assignment_from_hist(self):
sac = self._fake_sac()
sac.general_information["ein"] = UNIQUE_EIN_WITHOUT_DBKEY
cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, "84")
self.assertEqual(over_agency, None)
Expand All @@ -312,7 +311,7 @@ def test_cog_assignment_with_no_hist(self):
sac = self._fake_sac()
sac.general_information["ein"] = EIN_2023_ONLY
cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, "10")
self.assertEqual(over_agency, None)
Expand All @@ -326,7 +325,7 @@ def test_cog_assignment_with_multiple_hist(self):
sac = self._fake_sac()
sac.general_information["ein"] = DUP_EIN_WITHOUT_RESOLVER
cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, "10")
self.assertEqual(over_agency, None)
Expand All @@ -342,7 +341,7 @@ def test_cog_assignment_with_hist_resolution(self):
sac.general_information["ein"] = RESOLVABLE_EIN_WITHOUT_BASELINE
sac.general_information["auditee_uei"] = RESOLVABLE_UEI_WITHOUT_BASELINE
cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, "22")
self.assertEqual(over_agency, None)
Expand All @@ -357,7 +356,7 @@ def test_over_assignment(self):
federal_awards=self._fake_federal_awards_lt_cog_limit(),
)
cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, None)
self.assertEqual(over_agency, "15")
Expand All @@ -374,7 +373,7 @@ def test_over_assignment_with_hist(self):
)
sac.general_information["ein"] = UNIQUE_EIN_WITHOUT_DBKEY
cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, None)
self.assertEqual(over_agency, "15")
Expand Down Expand Up @@ -414,7 +413,7 @@ def test_cog_assignment_with_uei_in_baseline(self):
is_active=True,
)
cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, BASE_COG)
self.assertEqual(over_agency, None)
Expand All @@ -440,7 +439,7 @@ def test_cog_assignment_with_uei_in_baseline_and_overris(self):
self.assertEqual(len(cbs), 1)

cog_agency, _ = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
record_cog_assignment(sac.report_id, sac.submitted_by, cog_agency)
cas = CognizantAssignment.objects.all()
Expand Down Expand Up @@ -468,7 +467,7 @@ def test_cog_assignment_with_uei_in_baseline_and_overris(self):
sac.cognizant_agency = None
sac.save()
cog_agency, _ = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.audit_year
sac.federal_awards, sac.submission_status, sac.ein, sac.auditee_uei, sac.general_information["audit_year"]
)
record_cog_assignment(sac.report_id, sac.submitted_by, cog_agency)
sac = SingleAuditChecklist.objects.get(report_id=sac.report_id)
Expand All @@ -479,24 +478,31 @@ def test_cog_assignment_for_2024_audit(self):
sac.general_information["auditee_uei"] = "ZQGGHJH74DW7"
sac.general_information["ein"] = UNIQUE_EIN_WITHOUT_DBKEY
sac.general_information["report_id"] = "1111-03-GSAFAC-0000202460"
sac.general_information["total_amount_expended"] = "210000000"
sac.general_information["audit_year"] = "2024"
sac.general_information["auditee_fiscal_period_end"] = "2024-05-31"
sac.general_information["auditee_fiscal_period_start"] = "2023-06-01",
sac.general_information["auditee_fiscal_period_start"] = "2023-06-01"
sac.report_id = "1111-03-GSAFAC-0000202460"

gen = baker.make(
General,
report_id="1111-03-GSAFAC-0000202460",
auditee_ein=UNIQUE_EIN_WITHOUT_DBKEY,
auditee_uei="ZQGGHJH74DW7",
total_amount_expended="210000000",
audit_year="2024",
)
gen.save()

for i in range(6):
cfda = baker.make(
FederalAward,
report_id=sac.report_id,
report_id=gen,
federal_agency_prefix="84",
federal_award_extension="032",
amount_expended=10_000_000 * i,
is_direct="Y",
)
cfda.save()

sac.federal_awards = cfda
sac.save()

cog_agency, over_agency = compute_cog_over(
Expand All @@ -506,23 +512,80 @@ def test_cog_assignment_for_2024_audit(self):
self.assertEqual(cog_agency, "84")
self.assertEqual(over_agency, None)

def test_cog_assignment_for_2024_no_baseline(self):
pass

def test_cog_assignment_for_2027_w_baseline(self):
pass
sac = self._fake_sac()
sac.general_information["auditee_uei"] = "ZQGGHJH74DW7"
sac.general_information["ein"] = UNIQUE_EIN_WITHOUT_DBKEY
sac.general_information["report_id"] = "1111-03-GSAFAC-0000202760"
sac.general_information["auditee_fiscal_period_end"] = "2027-05-31"
sac.general_information["auditee_fiscal_period_start"] = "2026-06-01"
sac.report_id = "1111-03-GSAFAC-0000202760"

gen = baker.make(
General,
report_id="1111-03-GSAFAC-0000202760",
auditee_ein=UNIQUE_EIN_WITHOUT_DBKEY,
auditee_uei="ZQGGHJH74DW7",
total_amount_expended="210000000",
audit_year="2027",
)
gen.save()

for i in range(6):
cfda = baker.make(
FederalAward,
report_id=gen,
federal_agency_prefix="14",
federal_award_extension="032",
amount_expended=10_000_000 * i,
is_direct="Y",
)
cfda.save()

sac.save()

cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.general_information["ein"],
sac.general_information["auditee_uei"], sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, "84")
self.assertEqual(over_agency, None)

def test_cog_assignment_for_2027_no_baseline(self):
pass
sac = self._fake_sac()
sac.general_information["auditee_uei"] = "ZQGGHJH74DW8"
sac.general_information["ein"] = "EI27NOBAS"
sac.general_information["report_id"] = "1111-03-GSAFAC-0000202761"
sac.general_information["auditee_fiscal_period_end"] = "2027-05-31"
sac.general_information["auditee_fiscal_period_start"] = "2026-06-01"
sac.report_id = "1111-03-GSAFAC-0000202761"

def test_cog_assignment_for_2029_w_baseline(self):
pass
gen = baker.make(
General,
report_id="1111-03-GSAFAC-0000202761",
auditee_ein="EI27NOBAS",
auditee_uei="ZQGGHJH74DW8",
total_amount_expended="210000000",
audit_year="2027",
)
gen.save()

def test_cog_assignment_for_2029_no_baseline(self):
pass
for i in range(6):
cfda = baker.make(
FederalAward,
report_id=gen,
federal_agency_prefix="10",
federal_award_extension="032",
amount_expended=10_000_000 * i,
is_direct="Y",
)
cfda.save()

def test_cog_assignment_for_2031_w_baseline(self):
pass
sac.save()

def test_cog_assignment_for_2031_no_baseline(self):
pass
cog_agency, over_agency = compute_cog_over(
sac.federal_awards, sac.submission_status, sac.general_information["ein"],
sac.general_information["auditee_uei"], sac.general_information["audit_year"]
)
self.assertEqual(cog_agency, "10")
self.assertEqual(over_agency, None)

0 comments on commit af96e0c

Please sign in to comment.