mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 06:43:12 -04:00
Merge pull request #1129 from GSA/1114-reviseexpand-on-recent-batch-table-on-the-dashboard-page
Revise/expand on "Recent Batch" table on the dashboard page.
This commit is contained in:
@@ -54,6 +54,7 @@ from app.formatters import (
|
|||||||
format_datetime_normal,
|
format_datetime_normal,
|
||||||
format_datetime_relative,
|
format_datetime_relative,
|
||||||
format_datetime_short,
|
format_datetime_short,
|
||||||
|
format_datetime_short_america,
|
||||||
format_day_of_week,
|
format_day_of_week,
|
||||||
format_delta,
|
format_delta,
|
||||||
format_delta_days,
|
format_delta_days,
|
||||||
@@ -548,6 +549,7 @@ def add_template_filters(application):
|
|||||||
format_datetime_24h,
|
format_datetime_24h,
|
||||||
format_datetime_normal,
|
format_datetime_normal,
|
||||||
format_datetime_short,
|
format_datetime_short,
|
||||||
|
format_datetime_short_america,
|
||||||
valid_phone_number,
|
valid_phone_number,
|
||||||
linkable_name,
|
linkable_name,
|
||||||
format_date,
|
format_date,
|
||||||
|
|||||||
@@ -377,6 +377,32 @@ td.table-empty-message {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.job-table {
|
||||||
|
.usa-table {
|
||||||
|
thead th.file-name {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
thead th.template {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
thead th.time-sent {
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
thead th.sender {
|
||||||
|
width: 15%;
|
||||||
|
}
|
||||||
|
thead th.\#-of-recipients {
|
||||||
|
width: 5%;
|
||||||
|
}
|
||||||
|
thead th.report {
|
||||||
|
width: 5%;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
padding: 0.5rem 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#template-list {
|
#template-list {
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|||||||
@@ -98,6 +98,28 @@ def format_datetime_short(date):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def format_datetime_short_america(date):
|
||||||
|
return "{} at {}".format(format_date_numeric_america(date), format_time_12h(date))
|
||||||
|
|
||||||
|
|
||||||
|
def format_date_numeric_america(date):
|
||||||
|
date = parse_naive_dt(date)
|
||||||
|
|
||||||
|
preferred_tz = pytz.timezone(get_user_preferred_timezone())
|
||||||
|
return (
|
||||||
|
date.replace(tzinfo=timezone.utc).astimezone(preferred_tz).strftime("%m-%d-%Y")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def format_time_12h(date):
|
||||||
|
date = parse_naive_dt(date)
|
||||||
|
|
||||||
|
preferred_tz = pytz.timezone(get_user_preferred_timezone())
|
||||||
|
return (
|
||||||
|
date.replace(tzinfo=timezone.utc).astimezone(preferred_tz).strftime("%I:%M %p")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def format_datetime_relative(date):
|
def format_datetime_relative(date):
|
||||||
return "{} at {} {}".format(
|
return "{} at {} {}".format(
|
||||||
get_human_day(date), format_time_24h(date), get_user_preferred_timezone()
|
get_human_day(date), format_time_24h(date), get_user_preferred_timezone()
|
||||||
|
|||||||
@@ -47,54 +47,31 @@ def service_dashboard(service_id):
|
|||||||
if not current_user.has_permissions("view_activity"):
|
if not current_user.has_permissions("view_activity"):
|
||||||
return redirect(url_for("main.choose_template", service_id=service_id))
|
return redirect(url_for("main.choose_template", service_id=service_id))
|
||||||
|
|
||||||
download_availability = []
|
|
||||||
|
|
||||||
notifications = notification_api_client.get_notifications_for_service(
|
notifications = notification_api_client.get_notifications_for_service(
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
)["notifications"]
|
)["notifications"]
|
||||||
|
|
||||||
notificaton_job_ids = [
|
job_response = job_api_client.get_jobs(service_id)
|
||||||
notification["job"]["id"]
|
|
||||||
for notification in notifications
|
|
||||||
if "job" in notification
|
|
||||||
]
|
|
||||||
|
|
||||||
jobs = []
|
|
||||||
|
|
||||||
for notificaton_job_id in notificaton_job_ids:
|
|
||||||
job_data = job_api_client.get_job(service_id, notificaton_job_id)["data"]
|
|
||||||
if job_data:
|
|
||||||
jobs.append(job_data)
|
|
||||||
|
|
||||||
service_data_retention_days = 7
|
service_data_retention_days = 7
|
||||||
download_availability = []
|
jobs = [
|
||||||
for job in jobs:
|
{
|
||||||
message_type = job.get("template_type")
|
"job_id": job["id"],
|
||||||
if message_type is not None:
|
"time_left": get_time_left(job["created_at"]),
|
||||||
service_data_retention_days = current_service.get_days_of_retention(
|
"download_link": url_for(
|
||||||
message_type
|
".view_job_csv", service_id=current_service.id, job_id=job["id"]
|
||||||
)
|
|
||||||
time_left = get_time_left(job["created_at"])
|
|
||||||
download_link = (
|
|
||||||
url_for(
|
|
||||||
".view_job_csv",
|
|
||||||
service_id=current_service.id,
|
|
||||||
job_id=job["id"],
|
|
||||||
),
|
),
|
||||||
)
|
"notification_count": job["notification_count"],
|
||||||
download_availability.append(
|
"created_by": job["created_by"],
|
||||||
{
|
}
|
||||||
"job_id": job["id"],
|
for job in job_response["data"]
|
||||||
"time_left": time_left,
|
]
|
||||||
"download_link": download_link,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"views/dashboard/dashboard.html",
|
"views/dashboard/dashboard.html",
|
||||||
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
|
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
|
||||||
partials=get_dashboard_partials(service_id),
|
partials=get_dashboard_partials(service_id),
|
||||||
notifications=notifications,
|
notifications=notifications,
|
||||||
download_availability=download_availability,
|
jobs=jobs,
|
||||||
service_data_retention_days=service_data_retention_days,
|
service_data_retention_days=service_data_retention_days,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -29,51 +29,69 @@
|
|||||||
|
|
||||||
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
||||||
|
|
||||||
<h2 class="margin-top-4 margin-bottom-1">Batched Jobs</h2>
|
<h2 class="margin-top-4 margin-bottom-1">Recent Batches</h2>
|
||||||
|
|
||||||
<div class='job-table'>
|
<div class='job-table'>
|
||||||
{% call(item, row_number) list_table(
|
<table class="usa-table usa-table--borderless width-full">
|
||||||
notifications,
|
<thead class="table-field-headings">
|
||||||
caption="Batched Jobs",
|
<tr>
|
||||||
caption_visible=False,
|
<th scope="col" class="table-field-heading-first file-name">
|
||||||
border_visible=True,
|
<span>File name</span>
|
||||||
empty_message='No batched job messages found  (messages are kept for {} days)'.format(service_data_retention_days)|safe,
|
</th>
|
||||||
field_headings=['Template Name','Date/Time', 'Download (CSV) Report'],
|
<th scope="col" class="table-field-heading template">
|
||||||
field_headings_visible=False
|
<span>Template</span>
|
||||||
) %}
|
</th>
|
||||||
{% if item.job.original_file_name and item.job.id %}
|
<th scope="col" class="table-field-heading time-sent">
|
||||||
{% call row_heading() %}
|
<span>Time sent</span>
|
||||||
<a class="usa-link file-list-filename" href="/services/{{ item.service }}/jobs/{{ item.job.id }}">{{ item.job.original_file_name|replace('.csv', '') if item.job.id else '' }}</a>
|
</th>
|
||||||
{% endcall %}
|
<th scope="col" class="table-field-heading sender">
|
||||||
{% call row_heading() %}
|
<span>Sender</span>
|
||||||
{{ item.status|format_notification_status_as_time(
|
</th>
|
||||||
item.created_at|format_datetime_short,
|
<th scope="col" class="table-field-heading #-of-recipients">
|
||||||
(item.updated_at or item.created_at)|format_datetime_short)
|
<span># of Recipients</span>
|
||||||
}}
|
</th>
|
||||||
{% endcall %}
|
<th scope="col" class="table-field-heading report">
|
||||||
{% call row_heading() %}
|
<span>Report</span>
|
||||||
{% set availability = download_availability|selectattr('job_id', 'equalto', item.job.id)|first %}
|
</th>
|
||||||
{% if availability and availability.time_left != "Data no longer available" %}
|
</tr>
|
||||||
<a class="usa-link file-list-filename" href="{{ availability.download_link[0] }}">{{ "Download" if item.job.original_file_name else '' }}</a>
|
</thead>
|
||||||
<span>- {{ availability.time_left }}</span>
|
<tbody>
|
||||||
{% elif availability %}
|
{% for notification in notifications[:5] %}
|
||||||
<span>{{ availability.time_left }}</span>
|
{% if notification %}
|
||||||
{% endif %}
|
<tr class="table-row" id="{{ notification.job.id }}">
|
||||||
{% endcall %}
|
<th class="table-field">
|
||||||
{% endif %}
|
{{ notification.job.original_file_name if notification.job.original_file_name else 'Manually entered number'}}
|
||||||
{% endcall %}
|
<br>
|
||||||
|
<a class="usa-link file-list-filename" href="/services/{{ notification.service }}/jobs/{{ notification.job.id }}">View Batch</a>
|
||||||
|
</th>
|
||||||
|
<th class="table-field">
|
||||||
|
{{ notification.template.name }}
|
||||||
|
</th>
|
||||||
|
<th class="table-field">
|
||||||
|
{{ (notification.updated_at or notification.created_at)| format_datetime_short_america }}
|
||||||
|
</th>
|
||||||
|
<th class="table-field">
|
||||||
|
{{ notification.created_by.name }}
|
||||||
|
</th>
|
||||||
|
{% set job_available = jobs|selectattr('job_id', 'equalto', notification.job.id)|first %}
|
||||||
|
<th class="table-field">
|
||||||
|
{{ job_available.notification_count if job_available else ''}}
|
||||||
|
</th>
|
||||||
|
<th class="table-field">
|
||||||
|
{% if job_available and job_available.time_left != "Data no longer available" %}
|
||||||
|
<a class="usa-link file-list-filename" href="{{ job_available.download_link }}">
|
||||||
|
{{ "Download" if job_available.job_id else '' }}</a>
|
||||||
|
<span class="usa-hint">{{ job_available.time_left }}</span>
|
||||||
|
{% elif job_available %}
|
||||||
|
<span>{{ job_available.time_left }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% if show_pagination %}
|
|
||||||
{{ previous_next_navigation(prev_page, next_page) }}
|
|
||||||
{% elif next_page %}
|
|
||||||
<p class="table-show-more-link">
|
|
||||||
Only showing the first 50 messages
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
<h2 class="margin-top-4 margin-bottom-1">Usage</h2>
|
<h2 class="margin-top-4 margin-bottom-1">Usage</h2>
|
||||||
<h3 class="margin-bottom-0">Daily</h3>
|
<h3 class="margin-bottom-0">Daily</h3>
|
||||||
<p class="margin-0">Across all services</p>
|
<p class="margin-0">Across all services</p>
|
||||||
|
|||||||
@@ -71,49 +71,32 @@ FAKE_ONE_OFF_NOTIFICATION = {
|
|||||||
"total": 1,
|
"total": 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_ONE_OFF_JOB = {
|
MOCK_JOBS = {
|
||||||
"data": {
|
"data": [
|
||||||
"api_key": "mocked_api_key",
|
{
|
||||||
"billable_units": 1,
|
"archived": False,
|
||||||
"carrier": "mocked_carrier",
|
"created_at": "2024-01-04T20:43:52+00:00",
|
||||||
"client_reference": "mocked_client_reference",
|
"created_by": {
|
||||||
"created_at": "2024-01-04T20:43:52+00:00",
|
"id": "mocked_user_id",
|
||||||
"created_by": {
|
"name": "mocked_user",
|
||||||
"email_address": "mocked_email@example.com",
|
},
|
||||||
"id": "mocked_user_id",
|
"id": "mocked_notification_id",
|
||||||
"name": "mocked_user",
|
"job_status": "finished",
|
||||||
},
|
"notification_count": 1,
|
||||||
"document_download_count": None,
|
"original_file_name": "mocked_file.csv",
|
||||||
"id": "mocked_notification_id",
|
"processing_finished": "2024-01-25T23:02:25+00:00",
|
||||||
"international": False,
|
"processing_started": "2024-01-25T23:02:24+00:00",
|
||||||
"job": {"id": "mocked_job_id", "original_file_name": "mocked_file.txt"},
|
"scheduled_for": None,
|
||||||
"job_row_number": 0,
|
"service": "21b3ee3d-1cb0-4666-bfa0-9c5ac26d3fe3",
|
||||||
"key_name": "mocked_key_name",
|
"service_name": {"name": "Mock Texting Service"},
|
||||||
"key_type": "normal",
|
"statistics": [{"count": 1, "status": "sending"}],
|
||||||
"normalised_to": "+12133166548",
|
"template": "6a456418-498c-4c86-b0cd-9403c14a216c",
|
||||||
"notification_type": "sms",
|
"template_name": "Mock Template Name",
|
||||||
"personalisation": {"phonenumber": "+12133166548"},
|
|
||||||
"phone_prefix": "1",
|
|
||||||
"provider_response": "mocked_provider_response",
|
|
||||||
"rate_multiplier": 1.0,
|
|
||||||
"reference": "mocked_reference",
|
|
||||||
"reply_to_text": "mocked_reply_text",
|
|
||||||
"sent_at": "2024-01-04T20:43:53+00:00",
|
|
||||||
"sent_by": "mocked_sender",
|
|
||||||
"service": "mocked_service_id",
|
|
||||||
"status": "sending",
|
|
||||||
"template": {
|
|
||||||
"content": "((day of week)) and ((fave color))",
|
|
||||||
"id": "bd9caa7e-00ee-4c5a-839e-10ae1a7e6f73",
|
|
||||||
"name": "personalized",
|
|
||||||
"redact_personalisation": False,
|
|
||||||
"subject": None,
|
|
||||||
"template_type": "sms",
|
"template_type": "sms",
|
||||||
"version": 1,
|
"template_version": 3,
|
||||||
},
|
"updated_at": "2024-01-25T23:02:25+00:00",
|
||||||
"to": "+12133166548",
|
}
|
||||||
"updated_at": "2024-01-04T20:43:53+00:00",
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -309,7 +292,7 @@ def test_accepting_invite_removes_invite_from_session(
|
|||||||
sample_invite["email_address"] = user["email_address"]
|
sample_invite["email_address"] = user["email_address"]
|
||||||
|
|
||||||
client_request.login(user)
|
client_request.login(user)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -725,7 +708,7 @@ def test_new_invited_user_verifies_and_added_to_service(
|
|||||||
token="thisisnotarealtoken",
|
token="thisisnotarealtoken",
|
||||||
_expected_redirect=url_for("main.register_from_invite"),
|
_expected_redirect=url_for("main.register_from_invite"),
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
|
|||||||
@@ -85,49 +85,32 @@ FAKE_ONE_OFF_NOTIFICATION = {
|
|||||||
"total": 1,
|
"total": 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_ONE_OFF_JOB = {
|
MOCK_JOBS = {
|
||||||
"data": {
|
"data": [
|
||||||
"api_key": "mocked_api_key",
|
{
|
||||||
"billable_units": 1,
|
"archived": False,
|
||||||
"carrier": "mocked_carrier",
|
"created_at": "2024-01-04T20:43:52+00:00",
|
||||||
"client_reference": "mocked_client_reference",
|
"created_by": {
|
||||||
"created_at": "2024-01-04T20:43:52+00:00",
|
"id": "mocked_user_id",
|
||||||
"created_by": {
|
"name": "mocked_user",
|
||||||
"email_address": "mocked_email@example.com",
|
},
|
||||||
"id": "mocked_user_id",
|
"id": "mocked_notification_id",
|
||||||
"name": "mocked_user",
|
"job_status": "finished",
|
||||||
},
|
"notification_count": 1,
|
||||||
"document_download_count": None,
|
"original_file_name": "mocked_file.csv",
|
||||||
"id": "mocked_notification_id",
|
"processing_finished": "2024-01-25T23:02:25+00:00",
|
||||||
"international": False,
|
"processing_started": "2024-01-25T23:02:24+00:00",
|
||||||
"job": {"id": "mocked_job_id", "original_file_name": "mocked_file.txt"},
|
"scheduled_for": None,
|
||||||
"job_row_number": 0,
|
"service": "21b3ee3d-1cb0-4666-bfa0-9c5ac26d3fe3",
|
||||||
"key_name": "mocked_key_name",
|
"service_name": {"name": "Mock Texting Service"},
|
||||||
"key_type": "normal",
|
"statistics": [{"count": 1, "status": "sending"}],
|
||||||
"normalised_to": "+12133166548",
|
"template": "6a456418-498c-4c86-b0cd-9403c14a216c",
|
||||||
"notification_type": "sms",
|
"template_name": "Mock Template Name",
|
||||||
"personalisation": {"phonenumber": "+12133166548"},
|
|
||||||
"phone_prefix": "1",
|
|
||||||
"provider_response": "mocked_provider_response",
|
|
||||||
"rate_multiplier": 1.0,
|
|
||||||
"reference": "mocked_reference",
|
|
||||||
"reply_to_text": "mocked_reply_text",
|
|
||||||
"sent_at": "2024-01-04T20:43:53+00:00",
|
|
||||||
"sent_by": "mocked_sender",
|
|
||||||
"service": "mocked_service_id",
|
|
||||||
"status": "sending",
|
|
||||||
"template": {
|
|
||||||
"content": "((day of week)) and ((fave color))",
|
|
||||||
"id": "bd9caa7e-00ee-4c5a-839e-10ae1a7e6f73",
|
|
||||||
"name": "personalized",
|
|
||||||
"redact_personalisation": False,
|
|
||||||
"subject": None,
|
|
||||||
"template_type": "sms",
|
"template_type": "sms",
|
||||||
"version": 1,
|
"template_version": 3,
|
||||||
},
|
"updated_at": "2024-01-25T23:02:25+00:00",
|
||||||
"to": "+12133166548",
|
}
|
||||||
"updated_at": "2024-01-04T20:43:53+00:00",
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stub_template_stats = [
|
stub_template_stats = [
|
||||||
@@ -218,7 +201,7 @@ def test_get_started(
|
|||||||
"app.template_statistics_client.get_template_statistics_for_service",
|
"app.template_statistics_client.get_template_statistics_for_service",
|
||||||
return_value=copy.deepcopy(stub_template_stats),
|
return_value=copy.deepcopy(stub_template_stats),
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -248,7 +231,7 @@ def test_get_started_is_hidden_once_templates_exist(
|
|||||||
"app.template_statistics_client.get_template_statistics_for_service",
|
"app.template_statistics_client.get_template_statistics_for_service",
|
||||||
return_value=copy.deepcopy(stub_template_stats),
|
return_value=copy.deepcopy(stub_template_stats),
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -275,7 +258,7 @@ def test_inbound_messages_not_visible_to_service_without_permissions(
|
|||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
):
|
):
|
||||||
service_one["permissions"] = []
|
service_one["permissions"] = []
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -303,7 +286,6 @@ def test_inbound_messages_shows_count_of_messages_when_there_are_messages(
|
|||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
):
|
):
|
||||||
service_one["permissions"] = ["inbound_sms"]
|
service_one["permissions"] = ["inbound_sms"]
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -312,7 +294,8 @@ def test_inbound_messages_shows_count_of_messages_when_there_are_messages(
|
|||||||
"main.service_dashboard",
|
"main.service_dashboard",
|
||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
)
|
)
|
||||||
mock_get_jobs.assert_called_once_with(SERVICE_ONE_ID)
|
mock_get_jobs.assert_called_with(SERVICE_ONE_ID)
|
||||||
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
banner = page.select("a.banner-dashboard")[1]
|
banner = page.select("a.banner-dashboard")[1]
|
||||||
assert (
|
assert (
|
||||||
normalize_spaces(banner.text)
|
normalize_spaces(banner.text)
|
||||||
@@ -335,7 +318,6 @@ def test_inbound_messages_shows_count_of_messages_when_there_are_no_messages(
|
|||||||
mock_get_inbound_sms_summary_with_no_messages,
|
mock_get_inbound_sms_summary_with_no_messages,
|
||||||
):
|
):
|
||||||
service_one["permissions"] = ["inbound_sms"]
|
service_one["permissions"] = ["inbound_sms"]
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -344,7 +326,8 @@ def test_inbound_messages_shows_count_of_messages_when_there_are_no_messages(
|
|||||||
"main.service_dashboard",
|
"main.service_dashboard",
|
||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
)
|
)
|
||||||
mock_get_jobs.assert_called_once_with(SERVICE_ONE_ID)
|
mock_get_jobs.assert_called_with(SERVICE_ONE_ID)
|
||||||
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
banner = page.select("a.banner-dashboard")[1]
|
banner = page.select("a.banner-dashboard")[1]
|
||||||
assert normalize_spaces(banner.text) == "0 text messages received"
|
assert normalize_spaces(banner.text) == "0 text messages received"
|
||||||
assert banner["href"] == url_for("main.inbox", service_id=SERVICE_ONE_ID)
|
assert banner["href"] == url_for("main.inbox", service_id=SERVICE_ONE_ID)
|
||||||
@@ -585,7 +568,7 @@ def test_should_show_recent_templates_on_dashboard(
|
|||||||
"app.template_statistics_client.get_template_statistics_for_service",
|
"app.template_statistics_client.get_template_statistics_for_service",
|
||||||
return_value=copy.deepcopy(stub_template_stats),
|
return_value=copy.deepcopy(stub_template_stats),
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -642,7 +625,7 @@ def test_should_not_show_recent_templates_on_dashboard_if_only_one_template_used
|
|||||||
"app.template_statistics_client.get_template_statistics_for_service",
|
"app.template_statistics_client.get_template_statistics_for_service",
|
||||||
return_value=stats,
|
return_value=stats,
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -782,7 +765,6 @@ def test_should_show_upcoming_jobs_on_dashboard(
|
|||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -792,7 +774,8 @@ def test_should_show_upcoming_jobs_on_dashboard(
|
|||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
)
|
)
|
||||||
|
|
||||||
mock_get_jobs.assert_called_once_with(SERVICE_ONE_ID)
|
mock_get_jobs.assert_called_with(SERVICE_ONE_ID)
|
||||||
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mock_get_scheduled_job_stats.assert_called_once_with(SERVICE_ONE_ID)
|
mock_get_scheduled_job_stats.assert_called_once_with(SERVICE_ONE_ID)
|
||||||
|
|
||||||
assert normalize_spaces(page.select_one("main h2").text) == ("In the next few days")
|
assert normalize_spaces(page.select_one("main h2").text) == ("In the next few days")
|
||||||
@@ -824,7 +807,7 @@ def test_should_not_show_upcoming_jobs_on_dashboard_if_count_is_0(
|
|||||||
"soonest_scheduled_for": None,
|
"soonest_scheduled_for": None,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -850,7 +833,7 @@ def test_should_not_show_upcoming_jobs_on_dashboard_if_service_has_no_jobs(
|
|||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -904,7 +887,7 @@ def test_correct_font_size_for_big_numbers(
|
|||||||
service_one["permissions"] = permissions
|
service_one["permissions"] = permissions
|
||||||
|
|
||||||
mocker.patch("app.main.views.dashboard.get_dashboard_totals", return_value=totals)
|
mocker.patch("app.main.views.dashboard.get_dashboard_totals", return_value=totals)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -938,7 +921,6 @@ def test_should_not_show_jobs_on_dashboard_for_users_with_uploads_page(
|
|||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -947,7 +929,8 @@ def test_should_not_show_jobs_on_dashboard_for_users_with_uploads_page(
|
|||||||
"main.service_dashboard",
|
"main.service_dashboard",
|
||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
)
|
)
|
||||||
mock_get_jobs.assert_called_once_with(SERVICE_ONE_ID)
|
mock_get_jobs.assert_called_with(SERVICE_ONE_ID)
|
||||||
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
for filename in {
|
for filename in {
|
||||||
"export 1/1/2016.xls",
|
"export 1/1/2016.xls",
|
||||||
"all email addresses.xlsx",
|
"all email addresses.xlsx",
|
||||||
@@ -1209,7 +1192,7 @@ def test_menu_send_messages(
|
|||||||
):
|
):
|
||||||
service_one["permissions"] = ["email", "sms"]
|
service_one["permissions"] = ["email", "sms"]
|
||||||
|
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1246,7 +1229,7 @@ def test_menu_manage_service(
|
|||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1283,7 +1266,7 @@ def test_menu_main_settings(
|
|||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1319,7 +1302,7 @@ def test_menu_manage_api_keys(
|
|||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1359,7 +1342,7 @@ def test_menu_all_services_for_platform_admin_user(
|
|||||||
mock_get_inbound_sms_summary,
|
mock_get_inbound_sms_summary,
|
||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1404,7 +1387,7 @@ def test_route_for_service_permissions(
|
|||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.service_api_client.get_global_notification_count", side_effect=_get
|
"app.service_api_client.get_global_notification_count", side_effect=_get
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1460,7 +1443,7 @@ def test_service_dashboard_updates_gets_dashboard_totals(
|
|||||||
"sms": {"requested": 456, "delivered": 0, "failed": 0},
|
"sms": {"requested": 456, "delivered": 0, "failed": 0},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1586,7 +1569,7 @@ def test_org_breadcrumbs_do_not_show_if_service_has_no_org(
|
|||||||
mock_get_annual_usage_for_service,
|
mock_get_annual_usage_for_service,
|
||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1653,7 +1636,7 @@ def test_org_breadcrumbs_show_if_user_is_a_member_of_the_services_org(
|
|||||||
id_=ORGANISATION_ID,
|
id_=ORGANISATION_ID,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1689,7 +1672,7 @@ def test_org_breadcrumbs_do_not_show_if_user_is_a_member_of_the_services_org_but
|
|||||||
)
|
)
|
||||||
mocker.patch("app.models.service.Organization")
|
mocker.patch("app.models.service.Organization")
|
||||||
|
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
@@ -1727,7 +1710,7 @@ def test_org_breadcrumbs_show_if_user_is_platform_admin(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
@@ -1763,7 +1746,7 @@ def test_breadcrumb_shows_if_service_is_suspended(
|
|||||||
"app.service_api_client.get_service", return_value={"data": service_one_json}
|
"app.service_api_client.get_service", return_value={"data": service_one_json}
|
||||||
)
|
)
|
||||||
|
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
@@ -1797,7 +1780,7 @@ def test_service_dashboard_shows_usage(
|
|||||||
"count": 500,
|
"count": 500,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
@@ -1840,7 +1823,7 @@ def test_service_dashboard_shows_free_allowance(
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
@@ -1864,7 +1847,7 @@ def test_service_dashboard_shows_batched_jobs(
|
|||||||
mock_get_annual_usage_for_service,
|
mock_get_annual_usage_for_service,
|
||||||
mock_get_free_sms_fragment_limit,
|
mock_get_free_sms_fragment_limit,
|
||||||
):
|
):
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
return_value=FAKE_ONE_OFF_NOTIFICATION,
|
||||||
|
|||||||
@@ -57,49 +57,32 @@ FAKE_ONE_OFF_NOTIFICATION = {
|
|||||||
"total": 1,
|
"total": 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_ONE_OFF_JOB = {
|
MOCK_JOBS = {
|
||||||
"data": {
|
"data": [
|
||||||
"api_key": "mocked_api_key",
|
{
|
||||||
"billable_units": 1,
|
"archived": False,
|
||||||
"carrier": "mocked_carrier",
|
"created_at": "2024-01-04T20:43:52+00:00",
|
||||||
"client_reference": "mocked_client_reference",
|
"created_by": {
|
||||||
"created_at": "2024-01-04T20:43:52+00:00",
|
"id": "mocked_user_id",
|
||||||
"created_by": {
|
"name": "mocked_user",
|
||||||
"email_address": "mocked_email@example.com",
|
},
|
||||||
"id": "mocked_user_id",
|
"id": "mocked_notification_id",
|
||||||
"name": "mocked_user",
|
"job_status": "finished",
|
||||||
},
|
"notification_count": 1,
|
||||||
"document_download_count": None,
|
"original_file_name": "mocked_file.csv",
|
||||||
"id": "mocked_notification_id",
|
"processing_finished": "2024-01-25T23:02:25+00:00",
|
||||||
"international": False,
|
"processing_started": "2024-01-25T23:02:24+00:00",
|
||||||
"job": {"id": "mocked_job_id", "original_file_name": "mocked_file.txt"},
|
"scheduled_for": None,
|
||||||
"job_row_number": 0,
|
"service": "21b3ee3d-1cb0-4666-bfa0-9c5ac26d3fe3",
|
||||||
"key_name": "mocked_key_name",
|
"service_name": {"name": "Mock Texting Service"},
|
||||||
"key_type": "normal",
|
"statistics": [{"count": 1, "status": "sending"}],
|
||||||
"normalised_to": "+12133166548",
|
"template": "6a456418-498c-4c86-b0cd-9403c14a216c",
|
||||||
"notification_type": "sms",
|
"template_name": "Mock Template Name",
|
||||||
"personalisation": {"phonenumber": "+12133166548"},
|
|
||||||
"phone_prefix": "1",
|
|
||||||
"provider_response": "mocked_provider_response",
|
|
||||||
"rate_multiplier": 1.0,
|
|
||||||
"reference": "mocked_reference",
|
|
||||||
"reply_to_text": "mocked_reply_text",
|
|
||||||
"sent_at": "2024-01-04T20:43:53+00:00",
|
|
||||||
"sent_by": "mocked_sender",
|
|
||||||
"service": "mocked_service_id",
|
|
||||||
"status": "sending",
|
|
||||||
"template": {
|
|
||||||
"content": "((day of week)) and ((fave color))",
|
|
||||||
"id": "bd9caa7e-00ee-4c5a-839e-10ae1a7e6f73",
|
|
||||||
"name": "personalized",
|
|
||||||
"redact_personalisation": False,
|
|
||||||
"subject": None,
|
|
||||||
"template_type": "sms",
|
"template_type": "sms",
|
||||||
"version": 1,
|
"template_version": 3,
|
||||||
},
|
"updated_at": "2024-01-25T23:02:25+00:00",
|
||||||
"to": "+12133166548",
|
}
|
||||||
"updated_at": "2024-01-04T20:43:53+00:00",
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -139,7 +122,7 @@ def test_sign_out_user(
|
|||||||
with client_request.session_transaction() as session:
|
with client_request.session_transaction() as session:
|
||||||
assert session.get("user_id") is not None
|
assert session.get("user_id") is not None
|
||||||
# Check we are logged in
|
# Check we are logged in
|
||||||
mocker.patch("app.job_api_client.get_job", return_value=MOCK_ONE_OFF_JOB)
|
mocker.patch("app.job_api_client.get_jobs", return_value=MOCK_JOBS)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.notification_api_client.get_notifications_for_service",
|
"app.notification_api_client.get_notifications_for_service",
|
||||||
|
|||||||
Reference in New Issue
Block a user