mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-04 05:31:44 -04:00
update notifications page to take into account first class!
This commit is contained in:
@@ -90,7 +90,10 @@ def view_notification(service_id, notification_id):
|
||||
created_by=notification.get('created_by'),
|
||||
created_at=notification['created_at'],
|
||||
help=get_help_argument(),
|
||||
estimated_letter_delivery_date=get_letter_timings(notification['created_at']).earliest_delivery,
|
||||
estimated_letter_delivery_date=get_letter_timings(
|
||||
notification['created_at'],
|
||||
postage=notification['postage']
|
||||
).earliest_delivery,
|
||||
notification_id=notification['id'],
|
||||
postage=notification['postage'],
|
||||
can_receive_inbound=(current_service.has_permission('inbound_sms')),
|
||||
|
||||
@@ -141,7 +141,7 @@ def test_notification_page_shows_page_for_letter_notification(
|
||||
|
||||
count_of_pages = 3
|
||||
|
||||
mock_get_notification(mocker, fake_uuid, template_type='letter')
|
||||
mock_get_notification(mocker, fake_uuid, template_type='letter', postage='second')
|
||||
mocker.patch(
|
||||
'app.main.views.notifications.get_page_count_for_letter',
|
||||
return_value=count_of_pages
|
||||
@@ -174,6 +174,25 @@ def test_notification_page_shows_page_for_letter_notification(
|
||||
)
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 01:01")
|
||||
def test_notification_page_shows_page_for_first_class_letter_notification(
|
||||
client_request,
|
||||
mocker,
|
||||
fake_uuid,
|
||||
):
|
||||
mock_get_notification(mocker, fake_uuid, template_type='letter', postage='first')
|
||||
mocker.patch('app.main.views.notifications.get_page_count_for_letter', return_value=3)
|
||||
|
||||
page = client_request.get(
|
||||
'main.view_notification',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
notification_id=fake_uuid,
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select('main p:nth-of-type(2)')[0].text) == 'Postage: first class'
|
||||
assert normalize_spaces(page.select('main p:nth-of-type(3)')[0].text) == 'Estimated delivery date: 5 January'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('filetype', [
|
||||
'pdf', 'png'
|
||||
])
|
||||
|
||||
@@ -2645,6 +2645,7 @@ def mock_get_notification(
|
||||
template_name='sample template',
|
||||
is_precompiled_letter=False,
|
||||
key_type=None,
|
||||
postage=None
|
||||
):
|
||||
def _get_notification(
|
||||
service_id,
|
||||
@@ -2655,6 +2656,7 @@ def mock_get_notification(
|
||||
rows=1,
|
||||
status=notification_status,
|
||||
template_type=template_type,
|
||||
postage=postage
|
||||
)['notifications'][0]
|
||||
|
||||
noti['id'] = notification_id
|
||||
|
||||
Reference in New Issue
Block a user