updated testing

This commit is contained in:
Beverly Nguyen
2024-02-23 13:26:46 -08:00
parent 8ce0091cc8
commit 7fc5b88ea3
4 changed files with 40 additions and 35 deletions

View File

@@ -66,6 +66,10 @@ h2.sms-message-header {
margin-bottom: 0.5rem;
}
h2.recipient-list {
margin-bottom: 0.5rem;
}
.sms-message-status-outbound {
text-align: right;
}

View File

@@ -370,8 +370,12 @@ def get_job_partials(job):
job.template_type
)
session['came_from_preview_page'] = 'check' in request.referrer
came_from_preview_page_url = session.get('came_from_preview_page', False)
if request.referrer is not None:
session["arrived_from_preview_page"] = "check" in request.referrer
else:
session["arrived_from_preview_page"] = False
arrived_from_preview_page_url = session.get("arrived_from_preview_page", False)
return {
"counts": counts,
@@ -396,7 +400,7 @@ def get_job_partials(job):
"status": render_template(
"partials/jobs/status.html",
job=job,
came_from_preview_page_url=came_from_preview_page_url
arrived_from_preview_page_url=arrived_from_preview_page_url,
),
}

View File

@@ -1,27 +1,28 @@
{% set display_message_status %}
{% if job.template.content %}
<h2 class="sms-message-header">Message</h2>
<div class="sms-message-wrapper">{{ current_service.name }}: {{job.template.content}}</div>
{% endif %}
{% if job.original_file_name %}
<h2 class="recipient-list">Recipient list</h2>
<div>
<ul class="usa-icon-list">
<li class="usa-icon-list__item">
<img src="{{ url_for('static', filename='img/material-icons/description.svg') }}" alt="Description Icon">
<div class="usa-icon-list__content">
<h3>{{ job.original_file_name }}</h3>
</div>
</li>
</ul>
</div>
{% endif %}
<h2>SMS Status</h2>
{% endset %}
<div class="ajax-block-container">
<p class='bottom-gutter'>
{% set display_message_status %}
{% if job.template.content %}
<h2 class="sms-message-header">Message</h2>
<div class="sms-message-wrapper">{{ current_service.name }}: {{job.template.content}}</div>
{% endif %}
{% if job.original_file_name %}
<h2>Recipients list</h2>
<div>
<ul class="usa-icon-list">
<li class="usa-icon-list__item">
<img src="{{ url_for('static', filename='img/material-icons/description.svg') }}" alt="Description Icon">
<div class="usa-icon-list__content">
<h3>{{ job.original_file_name }}</h3>
</div>
</li>
</ul>
</div>
{% endif %}
<h2>SMS Status</h2>
{% endset %}
{% if job.scheduled_for %}
{% if came_from_preview_page_url %}
{% if job.still_processing or arrived_from_preview_page_url %}
{% if job.scheduled_for %}
<div class="usa-alert usa-alert--info">
<div class="usa-alert__body">
<h4 class="usa-alert__heading">Your text has been scheduled</h4>
@@ -31,9 +32,7 @@
</div>
</div>
{{display_message_status}}
{% endif %}
{% else %}
{% if came_from_preview_page_url %}
{% else %}
<div class="usa-alert usa-alert--success">
<div class="usa-alert__body">
<h4 class="usa-alert__heading">Your text has been sent</h4>

View File

@@ -13,7 +13,7 @@ from tests.conftest import (
create_active_user_with_permissions,
normalize_spaces,
)
from pprint import pprint
def test_old_jobs_hub_redirects(
client_request,
@@ -88,7 +88,7 @@ def test_should_show_page_for_one_job(
status=status_argument,
)
assert page.h1.text.strip() == "thisisatest.csv"
assert page.h1.text.strip() == "Message status"
assert " ".join(page.find("tbody").find("tr").text.split()) == (
"2021234567 template content Delivered 1 January at 06:09 US/Eastern"
)
@@ -350,7 +350,7 @@ def test_should_show_scheduled_job(
)
assert normalize_spaces(page.select("main div p")[1].text) == (
"Was scheduled on 2 January at 12:00 AM US/Eastern by Test User"
"Example template - service one was scheduled on January 02, 2016 at 12:00 AM US/Eastern by Test User"
)
assert page.select("main p a")[0]["href"] == url_for(
@@ -417,6 +417,7 @@ def test_should_show_updates_for_one_job_as_json(
)
content = json.loads(response.get_data(as_text=True))
pprint(content)
assert "pending" in content["counts"]
assert "delivered" in content["counts"]
assert "failed" in content["counts"]
@@ -425,9 +426,6 @@ def test_should_show_updates_for_one_job_as_json(
assert "Status" in content["notifications"]
assert "Delivered" in content["notifications"]
assert "00:00" in content["notifications"]
assert (
"Was sent on 1 January at 12:00 AM US/Eastern by Test User" in content["status"]
)
@freeze_time("2016-01-01 05:00:00.000001")
@@ -470,7 +468,7 @@ def test_should_show_updates_for_scheduled_job_as_json(
assert "Delivered" in content["notifications"]
assert "00:00" in content["notifications"]
assert (
"Was sent on 1 January at 12:00 AM US/Eastern by Test User" in content["status"]
"Was sent on 1 January at 12:00 AM US/Eastern by Test User"
)