Skip to content

Commit

Permalink
[Justice] Update test_custom_child_agency_name test to remove redun…
Browse files Browse the repository at this point in the history
…dancies and improve readability (Recidiviz/recidiviz-data#29595)

## Description of the change

Updates `test_custom_child_agency_name` based upon the suggestion of
Michelle in [this PR
](Recidiviz/recidiviz-data#29571 was
merged before I was able to address her feedback).

## Checklists

### Development

**This box MUST be checked by the submitter prior to merging**:
- [x] **Double- and triple-checked that there is no Personally
Identifiable Information (PII) being mistakenly added in this pull
request**

These boxes should be checked by the submitter prior to merging:
- [x] Tests have been written to cover the code changed/added as part of
this pull request

### Code review

These boxes should be checked by reviewers prior to merging:

- [ ] This pull request has a descriptive title and information useful
to a reviewer
- [ ] Potential security implications or infrastructural changes have
been considered, if relevant

GitOrigin-RevId: 4c3e467c81df6715a4bf2e72ee12bf880cc5bcbb
  • Loading branch information
nichelle-hall authored and Helper Bot committed May 18, 2024
1 parent 5e00624 commit 8dd2a5e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions recidiviz/tests/justice_counts/spreadsheet_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,9 @@ def test_custom_child_agency_name(self) -> None:
agency_id=agency.id,
)
session.add(spreadsheet)
# Excel workbook will have an invalid sheet.
# Excel workbook will not have any warnings or errors.
# create_excel_file is populating the agency name with the custom_child_agency_name.

file_path = create_excel_file(
system=schema.System.PRISONS,
file_name="test_custom_child_agency_name.xlsx",
Expand All @@ -434,11 +436,18 @@ def test_custom_child_agency_name(self) -> None:
upload_filetype=BulkUploadFileType.XLSX,
)

spreadsheet = session.query(schema.Spreadsheet).one()
spreadsheet = session.query(schema.Spreadsheet).one()
self.assertEqual(spreadsheet.status, schema.SpreadsheetStatus.INGESTED)
self.assertEqual(spreadsheet.ingested_by, user.auth0_user_id)

# Confirm that datapoints were ingested for the child agency
child_agency_datapoints = []
for datapoint_json_list in metric_key_to_datapoint_jsons.values():
child_agency_datapoints += [
datapoint_json
for datapoint_json in datapoint_json_list
if datapoint_json["agency_name"] == child_agency.name
]

self.assertTrue(
len(list(itertools.chain(*metric_key_to_datapoint_jsons.values()))) > 0
Expand Down

0 comments on commit 8dd2a5e

Please sign in to comment.