mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 02:44:10 -04:00
added download url and stat count in table
This commit is contained in:
@@ -20,7 +20,7 @@ def all_jobs_activity(service_id):
|
||||
jobs = job_api_client.get_page_of_jobs(service_id, page=page)
|
||||
all_jobs_dict = generate_job_dict(jobs)
|
||||
prev_page, next_page, pagination = handle_pagination(jobs, service_id, page)
|
||||
message_type='sms',
|
||||
message_type = ("sms",)
|
||||
return render_template(
|
||||
"views/activity/all-activity.html",
|
||||
all_jobs_dict=all_jobs_dict,
|
||||
@@ -97,12 +97,20 @@ def generate_job_dict(jobs):
|
||||
"created_by": job["created_by"],
|
||||
"template_name": job["template_name"],
|
||||
"delivered_count": next(
|
||||
(stat["count"] for stat in job["statistics"] if stat["status"] == "delivered"),
|
||||
None
|
||||
(
|
||||
stat["count"]
|
||||
for stat in job.get("statistics", [])
|
||||
if stat["status"] == "delivered"
|
||||
),
|
||||
None,
|
||||
),
|
||||
"failed_count": next(
|
||||
(stat["count"] for stat in job["statistics"] if stat["status"] == "failed"),
|
||||
None
|
||||
(
|
||||
stat["count"]
|
||||
for stat in job.get("statistics", [])
|
||||
if stat["status"] == "failed"
|
||||
),
|
||||
None,
|
||||
),
|
||||
}
|
||||
for job in jobs["data"]
|
||||
|
||||
@@ -21,7 +21,7 @@ MOCK_JOBS = {
|
||||
"scheduled_for": None,
|
||||
"service": "21b3ee3d-1cb0-4666-bfa0-9c5ac26d3fe3",
|
||||
"service_name": {"name": "Mock Texting Service"},
|
||||
"statistics": [{"count": 1, "status": "sending"}],
|
||||
"statistics": [{"count": 1, "status": "delivered"},{"count": 5, "status": "failed"}],
|
||||
"template": "6a456418-498c-4c86-b0cd-9403c14a216c",
|
||||
"template_name": "Mock Template Name",
|
||||
"template_type": "sms",
|
||||
@@ -63,7 +63,7 @@ def test_all_activity(
|
||||
assert table is not None, "Table not found in the response"
|
||||
|
||||
headers = [th.get_text(strip=True) for th in table.find_all("th")]
|
||||
expected_headers = ["Job ID#", "Template", "Time sent", "Sender", "Report"]
|
||||
expected_headers = ["Job ID#", "Template", "Time sent", "Sender", "Report", "Delivered", "Failed"]
|
||||
|
||||
assert (
|
||||
headers == expected_headers
|
||||
@@ -74,7 +74,7 @@ def test_all_activity(
|
||||
|
||||
job_row = rows[0]
|
||||
cells = job_row.find_all("td")
|
||||
assert len(cells) == 5, "Expected five columns in the job row"
|
||||
assert len(cells) == 7, "Expected five columns in the job row"
|
||||
|
||||
job_id_cell = cells[0].find("a").get_text(strip=True)
|
||||
|
||||
@@ -97,6 +97,17 @@ def test_all_activity(
|
||||
report_cell = cells[4].find("span").get_text(strip=True)
|
||||
assert report_cell == "N/A", f"Expected report 'N/A', but got '{report_cell}'"
|
||||
|
||||
delivered_cell = cells[5].get_text(strip=True)
|
||||
assert (
|
||||
delivered_cell == "1"
|
||||
), f"Expected delivered count '1', but got '{delivered_cell}'"
|
||||
|
||||
failed_cell = cells[6].get_text(strip=True)
|
||||
assert (
|
||||
failed_cell == "5"
|
||||
), f"Expected failed count '5', but got '{failed_cell}'"
|
||||
|
||||
|
||||
mock_get_page_of_jobs.assert_called_with(SERVICE_ONE_ID, page=current_page)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user