mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 07:46:23 -04:00
Put status under message
Since we’ve removed the table of notifications from the single notification page there’s no way of knowing the status of a notification. This re-adds it in a way that’s similar to how it looks on inbound messages.
This commit is contained in:
@@ -66,6 +66,7 @@ $path: '/static/images/';
|
|||||||
@import 'views/api';
|
@import 'views/api';
|
||||||
@import 'views/product-page';
|
@import 'views/product-page';
|
||||||
@import 'views/template';
|
@import 'views/template';
|
||||||
|
@import 'views/notification';
|
||||||
|
|
||||||
// TODO: break this up
|
// TODO: break this up
|
||||||
@import 'app';
|
@import 'app';
|
||||||
|
|||||||
18
app/assets/stylesheets/views/notification.scss
Normal file
18
app/assets/stylesheets/views/notification.scss
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
.notification-status {
|
||||||
|
|
||||||
|
@include core-16;
|
||||||
|
color: $secondary-text-colour;
|
||||||
|
margin-top: -$gutter-half;
|
||||||
|
|
||||||
|
&.error {
|
||||||
|
|
||||||
|
color: $error-colour;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $error-colour;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,13 @@
|
|||||||
<div class="ajax-block-container">
|
<div class="ajax-block-container">
|
||||||
<p class='heading-small bottom-gutter'>
|
<p class="notification-status {{ notification.status|format_notification_status_as_field_status }}">
|
||||||
Sent {% if notification.created_by %}by {{ notification.created_by.name }} {% endif %}
|
{% if notification.status|format_notification_status_as_url %}
|
||||||
on {{ notification.created_at|format_datetime_short }}
|
<a href="{{ notification.status|format_notification_status_as_url }}">
|
||||||
|
{% endif %}
|
||||||
|
{{ notification.status|format_notification_status(
|
||||||
|
notification.template.template_type
|
||||||
|
) }}
|
||||||
|
{% if notification.status|format_notification_status_as_url %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
import pytest
|
import pytest
|
||||||
from werkzeug.datastructures import MultiDict
|
|
||||||
|
|
||||||
from app.main.views.notifications import get_status_arg
|
|
||||||
from app.utils import (
|
from app.utils import (
|
||||||
REQUESTED_STATUSES,
|
REQUESTED_STATUSES,
|
||||||
FAILURE_STATUSES,
|
FAILURE_STATUSES,
|
||||||
@@ -14,13 +12,31 @@ from tests.app.test_utils import normalize_spaces
|
|||||||
from tests.conftest import mock_get_notification
|
from tests.conftest import mock_get_notification
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('notification_status, expected_status', [
|
||||||
|
('created', 'Sending'),
|
||||||
|
('sending', 'Sending'),
|
||||||
|
('delivered', 'Delivered'),
|
||||||
|
('failed', 'Failed'),
|
||||||
|
('temporary-failure', 'Phone not accepting messages right now'),
|
||||||
|
('permanent-failure', 'Phone number doesn’t exist'),
|
||||||
|
('technical-failure', 'Technical failure'),
|
||||||
|
])
|
||||||
@freeze_time("2016-01-01 11:09:00.061258")
|
@freeze_time("2016-01-01 11:09:00.061258")
|
||||||
def test_notification_status_page_shows_details(
|
def test_notification_status_page_shows_details(
|
||||||
client_request,
|
client_request,
|
||||||
mock_get_notification,
|
mocker,
|
||||||
service_one,
|
service_one,
|
||||||
fake_uuid,
|
fake_uuid,
|
||||||
|
notification_status,
|
||||||
|
expected_status,
|
||||||
):
|
):
|
||||||
|
|
||||||
|
_mock_get_notification = mock_get_notification(
|
||||||
|
mocker,
|
||||||
|
fake_uuid,
|
||||||
|
notification_status=notification_status
|
||||||
|
)
|
||||||
|
|
||||||
page = client_request.get(
|
page = client_request.get(
|
||||||
'main.view_notification',
|
'main.view_notification',
|
||||||
service_id=service_one['id'],
|
service_id=service_one['id'],
|
||||||
@@ -29,10 +45,10 @@ def test_notification_status_page_shows_details(
|
|||||||
|
|
||||||
assert page.find('div', {'class': 'sms-message-wrapper'}).text.strip() == 'service one: template content'
|
assert page.find('div', {'class': 'sms-message-wrapper'}).text.strip() == 'service one: template content'
|
||||||
assert normalize_spaces(page.select('.ajax-block-container p')[0].text) == (
|
assert normalize_spaces(page.select('.ajax-block-container p')[0].text) == (
|
||||||
'Sent by Test User on 1 January at 11:09am'
|
expected_status
|
||||||
)
|
)
|
||||||
|
|
||||||
mock_get_notification.assert_called_with(
|
_mock_get_notification.assert_called_with(
|
||||||
service_one['id'],
|
service_one['id'],
|
||||||
fake_uuid
|
fake_uuid
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user