Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,13 @@ class Command(BaseCommand):

BSO_CODES = ["MBD"]
REPORTS = [
ReportConfig("aggregate", ["3 months"], True),
ReportConfig(
"invites-not-sent", [datetime.now(tz=ZONE_INFO).date()], True, "failures"
),
ReportConfig("reconciliation", [datetime.now(tz=ZONE_INFO).date()], True),
ReportConfig("reconciliation", ["3 months"], True),
]
SMOKE_TEST_BSO_CODE = "SM0K3"
SMOKE_TEST_CONFIG = ReportConfig(
"reconciliation", [datetime.now(tz=ZONE_INFO).date()], False
)
SMOKE_TEST_CONFIG = ReportConfig("reconciliation", ["1 week"], False)

def add_arguments(self, parser):
parser.add_argument("--smoke-test", action="store_true")
Expand Down
40 changes: 0 additions & 40 deletions manage_breast_screening/notifications/queries/aggregate.sql

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,21 @@ def test_handle_creates_all_reports(self, dataframe, csv_data, now):

mock_read_sql, mock_blob_storage, mock_email_service = md

assert mock_read_sql.call_count == 3
assert mock_blob_storage.add.call_count == 3
assert mock_read_sql.call_count == 2
assert mock_blob_storage.add.call_count == 2
assert mock_email_service.send_reports_email.call_count == 1

for bso_code in Command.BSO_CODES:
mock_read_sql.assert_any_call(
Helper.sql("aggregate"), connection, params=["3 months", bso_code]
)
mock_read_sql.assert_any_call(
Helper.sql("failures"), connection, params=[now.date(), bso_code]
)
mock_read_sql.assert_any_call(
Helper.sql("reconciliation"), connection, params=[now.date(), bso_code]
Helper.sql("reconciliation"), connection, params=["3 months", bso_code]
)

aggregate_filename = (
f"{now.strftime('%Y-%m-%dT%H:%M:%S')}-{bso_code}-aggregate-report.csv"
)
failures_filename = f"{now.strftime('%Y-%m-%dT%H:%M:%S')}-{bso_code}-invites-not-sent-report.csv"
reconciliation_filename = f"{now.strftime('%Y-%m-%dT%H:%M:%S')}-{bso_code}-reconciliation-report.csv"

mock_blob_storage.add.assert_any_call(
aggregate_filename,
csv_data,
content_type="text/csv",
)
mock_blob_storage.add.assert_any_call(
failures_filename,
csv_data,
Expand All @@ -95,7 +84,6 @@ def test_handle_creates_all_reports(self, dataframe, csv_data, now):

mock_email_service.send_reports_email.assert_called_once_with(
{
aggregate_filename: csv_data,
failures_filename: csv_data,
reconciliation_filename: csv_data,
}
Expand Down Expand Up @@ -142,7 +130,7 @@ def test_smoke_test_argument_uses_correct_configuration(
mock_read_sql, mock_blob_storage, mock_email_service = md

mock_read_sql.assert_called_once_with(
Helper.sql("reconciliation"), connection, params=[now.date(), "SM0K3"]
Helper.sql("reconciliation"), connection, params=["1 week", "SM0K3"]
)
mock_blob_storage.add.assert_called_once_with(
"SM0K3-reconciliation-report.csv",
Expand Down

This file was deleted.