mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
fixed pytesting
This commit is contained in:
@@ -94,7 +94,7 @@ def service_dashboard(service_id):
|
|||||||
|
|
||||||
@main.route("/daily_stats.json")
|
@main.route("/daily_stats.json")
|
||||||
def get_daily_stats():
|
def get_daily_stats():
|
||||||
service_id = session.get('service_id')
|
service_id = session.get("service_id")
|
||||||
date_range = get_stats_date_range()
|
date_range = get_stats_date_range()
|
||||||
|
|
||||||
stats = service_api_client.get_service_notification_statistics_by_day(
|
stats = service_api_client.get_service_notification_statistics_by_day(
|
||||||
@@ -105,7 +105,7 @@ def get_daily_stats():
|
|||||||
|
|
||||||
@main.route("/daily_stats_by_user.json")
|
@main.route("/daily_stats_by_user.json")
|
||||||
def get_daily_stats_by_user():
|
def get_daily_stats_by_user():
|
||||||
service_id = session.get('service_id')
|
service_id = session.get("service_id")
|
||||||
date_range = get_stats_date_range()
|
date_range = get_stats_date_range()
|
||||||
user_id = current_user.id
|
user_id = current_user.id
|
||||||
stats = service_api_client.get_user_service_notification_statistics_by_day(
|
stats = service_api_client.get_user_service_notification_statistics_by_day(
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ MOCK_JOBS = {
|
|||||||
"scheduled_for": None,
|
"scheduled_for": None,
|
||||||
"service": "21b3ee3d-1cb0-4666-bfa0-9c5ac26d3fe3",
|
"service": "21b3ee3d-1cb0-4666-bfa0-9c5ac26d3fe3",
|
||||||
"service_name": {"name": "Mock Texting Service"},
|
"service_name": {"name": "Mock Texting Service"},
|
||||||
"statistics": [{"count": 1, "status": "delivered"}, {"count": 5, "status": "failed"}],
|
"statistics": [
|
||||||
|
{"count": 1, "status": "delivered"},
|
||||||
|
{"count": 5, "status": "failed"},
|
||||||
|
],
|
||||||
"template": "6a456418-498c-4c86-b0cd-9403c14a216c",
|
"template": "6a456418-498c-4c86-b0cd-9403c14a216c",
|
||||||
"template_name": "Mock Template Name",
|
"template_name": "Mock Template Name",
|
||||||
"template_type": "sms",
|
"template_type": "sms",
|
||||||
@@ -63,7 +66,15 @@ def test_all_activity(
|
|||||||
assert table is not None, "Table not found in the response"
|
assert table is not None, "Table not found in the response"
|
||||||
|
|
||||||
headers = [th.get_text(strip=True) for th in table.find_all("th")]
|
headers = [th.get_text(strip=True) for th in table.find_all("th")]
|
||||||
expected_headers = ["Job ID#", "Template", "Time sent", "Sender", "Report", "Delivered", "Failed"]
|
expected_headers = [
|
||||||
|
"Job ID#",
|
||||||
|
"Template",
|
||||||
|
"Time sent",
|
||||||
|
"Sender",
|
||||||
|
"Report",
|
||||||
|
"Delivered",
|
||||||
|
"Failed",
|
||||||
|
]
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
headers == expected_headers
|
headers == expected_headers
|
||||||
@@ -103,9 +114,7 @@ def test_all_activity(
|
|||||||
), f"Expected delivered count '1', but got '{delivered_cell}'"
|
), f"Expected delivered count '1', but got '{delivered_cell}'"
|
||||||
|
|
||||||
failed_cell = cells[6].get_text(strip=True)
|
failed_cell = cells[6].get_text(strip=True)
|
||||||
assert (
|
assert failed_cell == "5", f"Expected failed count '5', but got '{failed_cell}'"
|
||||||
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)
|
mock_get_page_of_jobs.assert_called_with(SERVICE_ONE_ID, page=current_page)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ EXCLUDED_ENDPOINTS = tuple(
|
|||||||
"get_users_report",
|
"get_users_report",
|
||||||
"get_daily_volumes",
|
"get_daily_volumes",
|
||||||
"get_daily_sms_provider_volumes",
|
"get_daily_sms_provider_volumes",
|
||||||
|
"get_daily_stats",
|
||||||
|
"get_daily_stats_by_user",
|
||||||
"get_volumes_by_service",
|
"get_volumes_by_service",
|
||||||
"get_example_csv",
|
"get_example_csv",
|
||||||
"get_notifications_as_json",
|
"get_notifications_as_json",
|
||||||
|
|||||||
Reference in New Issue
Block a user