update notifications page to take into account first class!

This commit is contained in:
Leo Hemsted
2018-09-28 17:08:37 +01:00
parent efab189ae8
commit 432f1286fe
3 changed files with 26 additions and 2 deletions

View File

@@ -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')),

View File

@@ -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'
])

View File

@@ -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