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

This commit is contained in:
Beverly Nguyen
2024-02-23 10:05:53 -08:00
9 changed files with 279 additions and 237 deletions

View File

@@ -40,7 +40,7 @@ FAKE_ONE_OFF_NOTIFICATION = {
"created_by": {
"email_address": "grsrbsrgsrf@fake.gov",
"id": "de059e0a-42e5-48bb-939e-4f76804ab739",
"name": "grsrbsrgsrf",
"name": "mocked_user",
},
"document_download_count": None,
"id": "a3442b43-0ba1-4854-9e0a-d2fba1cc9b81",
@@ -71,7 +71,7 @@ FAKE_ONE_OFF_NOTIFICATION = {
"template": {
"content": "((day of week)) and ((fave color))",
"id": "bd9caa7e-00ee-4c5a-839e-10ae1a7e6f73",
"name": "personalized",
"name": "Template Testing",
"redact_personalisation": False,
"subject": None,
"template_type": "sms",
@@ -94,7 +94,7 @@ MOCK_JOBS = {
"id": "mocked_user_id",
"name": "mocked_user",
},
"id": "mocked_notification_id",
"id": "55b242b5-9f62-4271-aff7-039e9c320578",
"job_status": "finished",
"notification_count": 1,
"original_file_name": "mocked_file.csv",
@@ -113,6 +113,19 @@ MOCK_JOBS = {
]
}
MOCK_JOBS_AND_NOTIFICATIONS = [
{
"created_at": MOCK_JOBS["data"][0]["created_at"],
"created_by": MOCK_JOBS["data"][0]["created_by"],
"download_link": "/services/21b3ee3d-1cb0-4666-bfa0-9c5ac26d3fe3/jobs/463b5ecb-4e32-43e5-aa90-0234d19fceaa.csv",
"job_id": "55b242b5-9f62-4271-aff7-039e9c320578",
"notification_count": MOCK_JOBS["data"][0]["notification_count"],
"notifications": FAKE_ONE_OFF_NOTIFICATION["notifications"],
"time_left": "Data available for 7 days",
"view_job_link": "/services/21b3ee3d-1cb0-4666-bfa0-9c5ac26d3fe3/jobs/463b5ecb-4e32-43e5-aa90-0234d19fceaa",
},
]
stub_template_stats = [
{
"template_type": "sms",
@@ -1855,11 +1868,11 @@ def test_service_dashboard_shows_batched_jobs(
page = client_request.get("main.service_dashboard", service_id=SERVICE_ONE_ID)
job_table = page.find("div", class_="job-table")
job_table_body = page.find("table", class_="job-table")
# Check if the "Job" table exists
assert job_table is not None
rows = job_table_body.find_all("tbody")[0].find_all("tr")
table_rows = job_table.find_all("tbody")[0].find_all("tr")
# # Check if the "Job" table exists
assert job_table_body is not None
assert len(table_rows) == 1
assert len(rows) == 1

View File

@@ -14,7 +14,7 @@ from tests.conftest import fake_uuid
def _get_notifications_csv(
row_number=1,
recipient="foo@bar.com",
recipient="8005555555",
template_name="foo",
template_type="sms",
job_name="bar.csv",
@@ -88,15 +88,15 @@ def get_notifications_csv_mock(
(
None,
[
"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",
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time\n",
"8005555555,foo,,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n",
],
),
(
"Anne Example",
[
"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
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time\n",
"8005555555,foo,Anne Example,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n", # noqa
],
),
],
@@ -124,53 +124,53 @@ def test_generate_notifications_csv_without_job(
[
(
"""
phone_number
2028675309
phone number
8005555555
""",
[
"Phone Number",
"Template",
"Sent by",
"Batch File",
"Carrier Response",
"Status",
"Time",
"phone_number",
],
[
"8005555555",
"foo",
"Fake Person",
"bar.csv",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"2028675309",
],
),
(
"""
phone_number, a, b, c
2028675309, 🐜,🐝,🦀
phone number, a, b, c
8005555555, 🐜,🐝,🦀
""",
[
"Phone Number",
"Template",
"Sent by",
"Batch File",
"Carrier Response",
"Status",
"Time",
"phone_number",
"a",
"b",
"c",
],
[
"8005555555",
"foo",
"Fake Person",
"bar.csv",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"2028675309",
"🐜",
"🐝",
"🦀",
@@ -178,29 +178,29 @@ def test_generate_notifications_csv_without_job(
),
(
"""
"phone_number", "a", "b", "c"
"2028675309","🐜,🐜","🐝,🐝","🦀"
"phone number", "a", "b", "c"
"8005555555","🐜,🐜","🐝,🐝","🦀"
""",
[
"Phone Number",
"Template",
"Sent by",
"Batch File",
"Carrier Response",
"Status",
"Time",
"phone_number",
"a",
"b",
"c",
],
[
"8005555555",
"foo",
"Fake Person",
"bar.csv",
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"2028675309",
"🐜,🐜",
"🐝,🐝",
"🦀",