mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-12 18:08:57 -04:00
Test that addresses display on uploads page
We didn’t have a test that checked for the first two lines of the address being displayed when rendering one-off letters on the uploads page. I double checked in the database and we store addresses in the `to` field with newlines, not commas.
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
) }}
|
||||
{% elif item.pdf_letter %}
|
||||
<p class="govuk-body govuk-!-margin-bottom-1">
|
||||
{% for line in item.recipient.split(',') %}
|
||||
{% for line in item.recipient.splitlines() %}
|
||||
{% if loop.index < 3 %}
|
||||
{{ line }}<br>
|
||||
{% endif %}
|
||||
|
||||
@@ -79,13 +79,32 @@ def test_get_upload_hub_page(
|
||||
'main.upload_letter', service_id=SERVICE_ONE_ID
|
||||
)
|
||||
|
||||
assert page.find_all(
|
||||
'a', {'class': 'file-list-filename-large'}
|
||||
)[0].attrs['href'] == '/services/{}/jobs/job_id_1'.format(SERVICE_ONE_ID)
|
||||
uploads = page.select('tbody tr')
|
||||
|
||||
assert page.find_all(
|
||||
'a', {'class': 'file-list-filename-large'}
|
||||
)[1].attrs['href'] == '/services/{}/notification/letter_id_1'.format(SERVICE_ONE_ID)
|
||||
assert normalize_spaces(uploads[0].text.strip()) == (
|
||||
'some.csv '
|
||||
'Sent 1 January 2016 at 11:09am '
|
||||
'0 sending 8 delivered 2 failed'
|
||||
)
|
||||
assert uploads[0].select_one('a.file-list-filename-large')['href'] == (
|
||||
'/services/{}/jobs/job_id_1'.format(SERVICE_ONE_ID)
|
||||
)
|
||||
|
||||
assert normalize_spaces(uploads[1].text.strip()) == (
|
||||
'some.pdf '
|
||||
'Sent 1 January 2016 at 11:09am '
|
||||
'Firstname Lastname '
|
||||
'123 Example Street'
|
||||
)
|
||||
assert normalize_spaces(str(uploads[1].select_one('.govuk-body'))) == (
|
||||
'<p class="govuk-body govuk-!-margin-bottom-1"> '
|
||||
'Firstname Lastname<br/> '
|
||||
'123 Example Street<br/> '
|
||||
'</p>'
|
||||
)
|
||||
assert uploads[1].select_one('a.file-list-filename-large')['href'] == (
|
||||
'/services/{}/notification/letter_id_1'.format(SERVICE_ONE_ID)
|
||||
)
|
||||
|
||||
|
||||
def test_get_upload_letter(client_request):
|
||||
|
||||
Reference in New Issue
Block a user