Merge remote-tracking branch 'origin/main' into 1169-display-confirmation-summary-on-the-preview-page

This commit is contained in:
Beverly Nguyen
2024-02-16 11:50:01 -08:00
10 changed files with 170 additions and 110 deletions

View File

@@ -10,21 +10,21 @@ def test_form_contains_next_24h(notify_admin):
# Friday
assert choices[0] == ("", "Now")
assert choices[1] == ("2016-01-01T07:00:00", "Today at 7am US/Eastern")
assert choices[13] == ("2016-01-01T19:00:00", "Today at 7pm US/Eastern")
assert choices[1] == ("2016-01-01T07:00:00-05:00", "Today at 7am US/Eastern")
assert choices[13] == ("2016-01-01T19:00:00-05:00", "Today at 7pm US/Eastern")
# Saturday
assert choices[14] == ("2016-01-01T20:00:00", "Today at 8pm US/Eastern")
assert choices[37] == ("2016-01-02T19:00:00", "Tomorrow at 7pm US/Eastern")
assert choices[14] == ("2016-01-01T20:00:00-05:00", "Today at 8pm US/Eastern")
assert choices[37] == ("2016-01-02T19:00:00-05:00", "Tomorrow at 7pm US/Eastern")
# Sunday
assert choices[38] == ("2016-01-02T20:00:00", "Tomorrow at 8pm US/Eastern")
assert choices[38] == ("2016-01-02T20:00:00-05:00", "Tomorrow at 8pm US/Eastern")
# Monday
assert choices[62] == ("2016-01-03T20:00:00", "Sunday at 8pm US/Eastern")
assert choices[80] == ("2016-01-04T14:00:00", "Monday at 2pm US/Eastern")
assert choices[84] == ("2016-01-04T18:00:00", "Monday at 6pm US/Eastern")
assert choices[85] == ("2016-01-04T19:00:00", "Monday at 7pm US/Eastern")
assert choices[62] == ("2016-01-03T20:00:00-05:00", "Sunday at 8pm US/Eastern")
assert choices[80] == ("2016-01-04T14:00:00-05:00", "Monday at 2pm US/Eastern")
assert choices[84] == ("2016-01-04T18:00:00-05:00", "Monday at 6pm US/Eastern")
assert choices[85] == ("2016-01-04T19:00:00-05:00", "Monday at 7pm US/Eastern")
with pytest.raises(IndexError):
assert choices[

View File

@@ -325,6 +325,7 @@ def test_route_permissions(
def _get(mocker):
return {"count": 0}
mocker.patch("app.service_api_client.get_service_statistics")
mocker.patch(
"app.service_api_client.get_global_notification_count", side_effect=_get
)
@@ -358,6 +359,8 @@ def test_route_invalid_permissions(
def _get(mocker):
return {"count": 0}
mocker.patch("app.service_api_client.get_service_statistics")
mocker.patch(
"app.service_api_client.get_global_notification_count", side_effect=_get
)

View File

@@ -18,7 +18,6 @@ def _get_notifications_csv(
template_name="foo",
template_type="sms",
job_name="bar.csv",
carrier="ATT Mobility",
provider_response="Did not like it",
status="Delivered",
created_at="1943-04-19 12:00:00",
@@ -46,20 +45,19 @@ def _get_notifications_csv(
"notifications": [
{
"row_number": row_number + i,
"to": recipient,
"recipient": recipient,
"client_reference": "ref 1234",
"template_name": template_name,
"template_type": template_type,
"template": {"name": template_name, "template_type": template_type},
"job_name": job_name,
"carrier": carrier,
"provider_response": provider_response,
"status": status,
"created_at": created_at,
"updated_at": None,
"created_by_name": created_by_name,
"created_by_email_address": created_by_email_address,
"to": recipient,
"recipient": recipient,
"client_reference": "ref 1234",
}
for i in range(rows)
],
@@ -90,15 +88,15 @@ def get_notifications_csv_mock(
(
None,
[
"Recipient,Template,Type,Sent by,Job,Carrier,Carrier Response,Status,Time\n",
"foo@bar.com,foo,sms,,,ATT Mobility,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n",
"Recipient,Template,Sent by,Batch File,Carrier Response,Status,Time\n",
"foo@bar.com,foo,,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n",
],
),
(
"Anne Example",
[
"Recipient,Template,Type,Sent by,Job,Carrier,Carrier Response,Status,Time\n",
"foo@bar.com,foo,sms,Anne Example,,ATT Mobility,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n", # noqa
"Recipient,Template,Sent by,Batch File,Carrier Response,Status,Time\n",
"foo@bar.com,foo,Anne Example,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n", # noqa
],
),
],
@@ -130,28 +128,22 @@ def test_generate_notifications_csv_without_job(
2028675309
""",
[
"Row number",
"phone_number",
"Template",
"Type",
"Sent by",
"Job",
"Carrier",
"Batch File",
"Carrier Response",
"Status",
"Time",
"phone_number",
],
[
"1",
"2028675309",
"foo",
"sms",
"Fake Person",
"bar.csv",
"ATT Mobility",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"2028675309",
],
),
(
@@ -160,34 +152,28 @@ def test_generate_notifications_csv_without_job(
2028675309, 🐜,🐝,🦀
""",
[
"Row number",
"Template",
"Sent by",
"Batch File",
"Carrier Response",
"Status",
"Time",
"phone_number",
"a",
"b",
"c",
"Template",
"Type",
"Sent by",
"Job",
"Carrier",
"Carrier Response",
"Status",
"Time",
],
[
"1",
"foo",
"Fake Person",
"bar.csv",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"2028675309",
"🐜",
"🐝",
"🦀",
"foo",
"sms",
"Fake Person",
"bar.csv",
"ATT Mobility",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
],
),
(
@@ -196,34 +182,28 @@ def test_generate_notifications_csv_without_job(
"2028675309","🐜,🐜","🐝,🐝","🦀"
""",
[
"Row number",
"Template",
"Sent by",
"Batch File",
"Carrier Response",
"Status",
"Time",
"phone_number",
"a",
"b",
"c",
"Template",
"Type",
"Sent by",
"Job",
"Carrier",
"Carrier Response",
"Status",
"Time",
],
[
"1",
"foo",
"Fake Person",
"bar.csv",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"2028675309",
"🐜,🐜",
"🐝,🐝",
"🦀",
"foo",
"sms",
"Fake Person",
"bar.csv",
"ATT Mobility",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
],
),
],

View File

@@ -2319,6 +2319,8 @@ def client_request(logged_in_client, mocker, service_one): # noqa (C901 too com
def _get(mocker):
return {"count": 0}
mocker.patch("app.service_api_client.get_service_statistics")
mocker.patch(
"app.service_api_client.get_global_notification_count", side_effect=_get
)